fix(ci): publish docker #2
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 Packages | |
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 | |
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 | |
- 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: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Publish | |
env: | |
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx nx container ${{ steps.app_name.outputs.value }} --configuration production --verbose |