Skip to content

fix: gh action step order #14

fix: gh action step order

fix: gh action step order #14

Workflow file for this run

name: CI
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
jobs:
build:
name: Build and Push
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Enable corepack
run: corepack enable
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 21
cache: "yarn"
- name: Install dependencies
run: yarn
- name: Build
run: yarn build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: downcase REPO
id: repo_name
run: |
echo "REPO=${GITHUB_REPOSITORY@L}" >> "$GITHUB_OUTPUT"
- name: Get commit hash
id: git_hash
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Get repo URL
id: repo_url
run: echo "REPO_URL=https://github.com/${{ github.repository }}" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./Dockerfile.gh
push: true
tags: ${{steps.repo_name.outputs.REPO}}:latest
build-args: |
COMMIT_HASH=${{ steps.git_hash.outputs.COMMIT_HASH }}
REPO_URL=${{ steps.repo_url.outputs.REPO_URL }}