Update main.yml #153
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 to GHCR | |
on: | |
push: | |
branches: | |
- "release" | |
- "versions/*" | |
tags: | |
- "v*.*.*" | |
paths-ignore: | |
- '**.md' | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
jobs: | |
run-tests: | |
name: Run Tests | |
uses: ./.github/workflows/node.js.yml | |
publish: | |
runs-on: ubuntu-24.04-arm | |
needs: [run-tests] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Remove v prefix from tag name | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
run: | | |
echo "BRANCH_NAME=${TAG_NAME#v}" >> $GITHUB_ENV | |
env: | |
TAG_NAME: ${{ env.BRANCH_NAME }} | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Login to GHCR | |
env: | |
REGISTRY: ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Extract metadata for Docker GHCR | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
latest | |
${{ github.sha }} | |
${{ env.BRANCH_NAME }} | |
# - name: Setup buildx | |
# uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=min | |
file: Dockerfile | |
platforms: linux/arm64/v8 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |