38 lines
1019 B
YAML
38 lines
1019 B
YAML
name: Build and Publish Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test-and-publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Run tracker test suites
|
|
run: npm test
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.trevorstocks.ca
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.REGISTRY_TOKEN || secrets.GITEA_TOKEN }}
|
|
|
|
- name: Build and push image to git.trevorstocks.ca
|
|
run: |
|
|
IMAGE="git.trevorstocks.ca/faroegames/oaktracker"
|
|
SHA_TAG="sha-$(echo "${{ github.sha }}" | cut -c1-7)"
|
|
docker build -t "${IMAGE}:latest" -t "${IMAGE}:${SHA_TAG}" .
|
|
docker push "${IMAGE}:latest"
|
|
docker push "${IMAGE}:${SHA_TAG}"
|