Release #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '32 4 1-31/3 * *' | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get docker-slim | |
run: | | |
SLIM_VERSION=1.40.10 | |
curl -L -o ds.tar.gz https://downloads.dockerslim.com/releases/$SLIM_VERSION/dist_linux.tar.gz | |
tar -xvzf ds.tar.gz | |
mv dist_linux/* $GITHUB_WORKSPACE/ | |
rm -rfv ds.tar.gz dist_linux/ | |
- name: Setup | |
run: | | |
npm i | |
- name: Scrape and Build | |
env: | |
BUILD_ENV: production | |
run: | | |
npm run build | |
- name: Upload search index | |
uses: cloudflare/[email protected] | |
with: | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
command: r2 object put gmodwiki/search_index.json --file ./public/search_index.json | |
- name: Build final pack | |
env: | |
BUILD_ENV: production | |
run: | | |
# Temporarily move it out of the public dir to keep it out of the Cloudflare bundle | |
mv --verbose ./public/search_index.json . | |
npm run astrobuild | |
- name: Publish Site | |
uses: cloudflare/[email protected] | |
with: | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
command: pages deploy --project-name=gmodwiki ./dist | |
- name: Build starter image | |
run: | | |
mv --verbose ./search_index.json ./public/ | |
docker build --tag gmodwiki_fat:latest . | |
- name: Make slim image | |
run: | | |
$GITHUB_WORKSPACE/docker-slim build \ | |
--target gmodwiki_fat:latest \ | |
--include-path /app/dist \ | |
--include-path /app/node_modules \ | |
--http-probe-off \ | |
--remove-file-artifacts \ | |
--continue-after 10 \ | |
--show-clogs --show-blogs \ | |
--tag ghcr.io/cfc-servers/gmodwiki:latest \ | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Tag and push image | |
run: | | |
docker push ghcr.io/cfc-servers/gmodwiki --all-tags |