Skip to content

chore(deps): bump rustls from 0.21.10 to 0.21.11 #261

chore(deps): bump rustls from 0.21.10 to 0.21.11

chore(deps): bump rustls from 0.21.10 to 0.21.11 #261

Workflow file for this run

name: wasm_app
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [main]
permissions:
packages: write
jobs:
test:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: front-end
steps:
- uses: actions/checkout@v4
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cargo test
run: cargo test
- name: Wasm test
run: wasm-pack test --headless --chrome
build_and_deploy:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-22.04
name: Build and Deploy
environment: "${{ github.event_name == 'push' && 'prod' || 'staging' }}"
env:
DOCKER_BUILDKIT: "1"
steps:
- uses: actions/checkout@v4
- name: Prepare docker compose file(s) - PR
if: github.event_name == 'pull_request'
run: |
printf 'Deleting docker-compose.override.yml (it is only used for development)\n'
rm docker-compose.override.yml
printf 'Adding build args and tags docker-compose.yml\n'
IMAGE=ghcr.io/christianfosli/snake/wasm-app \
COMMIT_SHA="$(git rev-parse --short HEAD)" \
HIGHSCORE_API_BASE_URL=https://highscores-staging.playsnake.no \
yq -i '
.services.app.build.tags[0] = strenv(IMAGE) + ":" + strenv(COMMIT_SHA) |
.services.app.build.args.VERSION = strenv(COMMIT_SHA) |
.services.app.build.args.HIGHSCORE_API_BASE_URL= strenv(HIGHSCORE_API_BASE_URL)
' docker-compose.yml
printf '\n\n'
yq '.services.app' docker-compose.yml
- name: Prepare docker compose file(s) - Prod
if: github.event_name != 'pull_request'
run: |
printf 'Deleting docker-compose.override.yml (it is only used for development)\n'
rm docker-compose.override.yml
printf 'Adding build args and tags to docker-compose.yml\n'
IMAGE=ghcr.io/christianfosli/snake/wasm-app \
COMMIT_SHA="$(git rev-parse --short HEAD)" \
HIGHSCORE_API_BASE_URL=https://highscores.playsnake.no \
yq -i '
.services.app.build.tags[0] = strenv(IMAGE) + ":" + strenv(COMMIT_SHA) |
.services.app.build.tags[1] = strenv(IMAGE) + ":latest" |
.services.app.build.args.VERSION = strenv(COMMIT_SHA) |
.services.app.build.args.HIGHSCORE_API_BASE_URL= strenv(HIGHSCORE_API_BASE_URL)
' docker-compose.yml
printf '\n\n'
yq '.services.app' docker-compose.yml
echo "BUILD_VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "HIGHSCORE_API_BASE_URL=https://highscores.playsnake.no" >> $GITHUB_ENV
- name: Docker build
run: docker compose build app
- name: Login to ghcr
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push
# Not needed for deployment, but might be nice for running locally
if: github.event_name != 'pull_request'
run: |
docker push --all-tags ghcr.io/christianfosli/snake/wasm-app
- name: Extract files to deploy
# Since we deploy to azure static web app rather than container we need to extract the build files to deploy
run: |
docker compose create app
docker compose cp app:/usr/share/nginx/html out
- name: Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: upload
app_location: out
api_location: "" # leave blank or bring-your-own functions
output_location: ""
skip_app_build: true
close_pull_request:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-22.04
name: Close Pull Request
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: close