automate workflow [Build] #2
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 | |
on: | |
workflow_dispatch: | |
push: | |
jobs: | |
publish: | |
if: contains(github.event.head_commit.message, '[Build]') | |
name: Publish | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
### Checkout Repo | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
### Setup Node | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
### Install Dependencies and Build | |
- run: npm install && npm run build | |
### Login to GHCR | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
### Extract Docker Metadata | |
- name: Extract Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: latest | |
### Build and Push Package | |
- name: Build and Push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |