Skip to content

automate workflow [Build] #17

automate workflow [Build]

automate workflow [Build] #17

Workflow file for this run

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
### 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 }}
### Set Build Version
- name: Set Build Version
id: build-version
run:
echo "BUILD_VERSION=`date +%y%j%H%M`" >> "$GITHUB_OUTPUT"
### Extract Docker Metadata
- name: Extract Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
${{ steps.build-version.outputs.BUILD_VERSION }}
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 }}