chore(ci): build only linux/amd64 for now #5
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
name: publish-docker | |
on: | |
push: | |
tags: | |
- platform@v*.*.* | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
jobs: | |
publish-docker: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
id-token: write # needed for provenance data generation | |
timeout-minutes: 15 | |
steps: | |
- name: Login to Github container registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Extract app name | |
id: app_name | |
run: echo "value=$(echo $GITHUB_REF_NAME | cut -d '@' -f 1)" >> $GITHUB_OUTPUT | |
# validate the version is the same as the tag | |
- name: Validate version | |
id: app_version | |
run: | | |
ACTUAL_VERSION=$(jq -r '.version' apps/${{ steps.app_name.outputs.value }}/package.json) | |
EXPECTED_VERSION=$(echo $GITHUB_REF_NAME | sed 's/.*@v//') | |
if [ "$ACTUAL_VERSION" != "$EXPECTED_VERSION" ]; then | |
echo "Version mismatch between package.json ($ACTUAL_VERSION) and tag ($EXPECTED_VERSION)" | |
exit 1 | |
fi | |
echo "value=$EXPECTED_VERSION" >> $GITHUB_OUTPUT | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
cache: yarn | |
- name: Install dependencies | |
run: yarn | |
- name: Prepare image | |
run: yarn nx prepare-image ${{ steps.app_name.outputs.value }} --verbose | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Docker meta | |
id: image_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/lironer/bundlemon-${{ steps.app_name.outputs.value }} | |
flavor: latest=auto | |
tags: | | |
type=semver,value=${{ steps.app_version.outputs.value }},pattern={{version}} | |
type=semver,value=${{ steps.app_version.outputs.value }},pattern={{major}}.{{minor}} | |
type=semver,value=${{ steps.app_version.outputs.value }},pattern=v{{major}} | |
- name: Build & Publish | |
uses: docker/build-push-action@v6 | |
with: | |
context: apps/${{ steps.app_name.outputs.value }} | |
tags: ${{ steps.image_meta.outputs.tags }} | |
labels: ${{ steps.image_meta.outputs.labels }} | |
cache-from: | | |
type=registry,ref=ghcr.io/lironer/bundlemon-${{ steps.app_name.outputs.value }}:latest | |
cache-to: type=inline | |
platforms: linux/amd64 | |
provenance: true | |
push: true | |