Skip to content

Build container(s) & Upload Artifacts #23

Build container(s) & Upload Artifacts

Build container(s) & Upload Artifacts #23

Workflow file for this run

name: Build container(s) & Upload Artifacts
on:
push:
tags:
- '*'
jobs:
build-container-and-deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout from GitHub
uses: actions/checkout@v4
- name: Setup qemu
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine Version
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# when the branch is main, replace main with latest
[ "$VERSION" == "main" ] && VERSION=latest
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ env.VERSION }}
- name: Extract docker build artifacts
run: |
./extract-artifacts.sh ghcr.io/${{ github.repository }}
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*