This commit is contained in:
@@ -2,30 +2,48 @@ name: Build and publish
|
||||
run-name: Build docker image and publish to registry
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 10,22 * * *'
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'main'
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- run: apt update
|
||||
- run: apt install -y libatk1.0-0 libatk-bridge2.0-0 libasound2t64 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev
|
||||
name: Prepare environment
|
||||
- uses: https://github.com/actions/checkout@v4
|
||||
- name: Use Node.js
|
||||
uses: https://github.com/actions/setup-node@v3
|
||||
- name: Checkout code
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: https://github.com/docker/login-action@v3
|
||||
with:
|
||||
node-version: '20.18'
|
||||
- run: npm i
|
||||
name: Install dependencies
|
||||
- run: node index.mjs
|
||||
name: Run app
|
||||
env:
|
||||
GHOSTFOLIO_SECURITY_TOKEN: ${{ secrets.GHOSTFOLIO_SECURITY_TOKEN }}
|
||||
GHOSTFOLIO_HOST: ${{ secrets.GHOSTFOLIO_HOST }}
|
||||
registry: 10.0.2.28:222
|
||||
username: lino
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: https://github.com/docker/metadata-action@v5
|
||||
with:
|
||||
images: 10.0.2.28:222/${{ gitea.repository }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,prefix={{branch}}-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
Reference in New Issue
Block a user