Merge pull request #72 from danielemery/71-upgrade-dependencies #23
Workflow file for this run
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
# This workflow publishes the Docker image to the GitHub Container Registry and the Helm chart to the appropriate s3 bucket. | |
# It's triggered when a new tag is pushed to the repository, this can either be in main (as a release tag) or in a feature | |
# branch (as a prerelease tag). | |
name: Publish | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+*' | |
# Note this alone is not enough to give the action write access | |
# In the registry settings https://github.com/users/danielemery/packages/container/quizlord-client/settings | |
# you must also add the action with write access under Manage actions access | |
permissions: | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
NODE_VERSION: 22.10.0 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Configure node | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install packages | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Upload build artifacts | |
uses: actions/[email protected] | |
with: | |
name: build-artifacts | |
path: | | |
dist | |
env.schema.js | |
Dockerfile | |
.dockerignore | |
- name: Upload helm chart | |
uses: actions/[email protected] | |
with: | |
name: helm-chart | |
path: helm | |
docker-publish: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: nowsprinting/[email protected] | |
id: version | |
with: | |
prefix: 'v' | |
- name: Download build artifacts | |
uses: actions/[email protected] | |
with: | |
name: build-artifacts | |
- name: Log in to the Container registry | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: | | |
latest=${{ steps.version.outputs.is_stable == 'true' && 'true' || 'false' }} | |
- name: Build and push Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
IMAGE_VERSION=${{ steps.version.outputs.full }} | |
helm-publish: | |
needs: | |
- build | |
- docker-publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: nowsprinting/[email protected] | |
id: version | |
with: | |
prefix: 'v' | |
- name: Download chart definition | |
uses: actions/[email protected] | |
with: | |
name: helm-chart | |
path: helm | |
- name: Configure AWS credentials | |
uses: aws-actions/[email protected] | |
with: | |
aws-access-key-id: ${{ secrets.HELM_DEPLOY_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.HELM_DEPLOY_SECRET }} | |
aws-region: ${{ vars.HELM_DEPLOY_REGION }} | |
- name: Publish chart | |
uses: danielemery/helm-release-action@f19adb815088a067bb839b224decb0611072652d | |
with: | |
repo: s3://helm.demery.net/ | |
chart: ./helm | |
version: ${{ steps.version.outputs.full }} | |
appVersion: ${{ steps.version.outputs.full }} |