feat: gitea pipeline and more
This commit is contained in:
1 parent
7cba626704
commit
b89a053622
2 files changed
+10
-14
No files matched your search
@@ -1,10 +1,13 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
|
# Runs on Gitea Actions (git.greboh.dev), which reads .github/workflows when .gitea/workflows does not exist.
|
||||||
# Pull requests: build, test and build the image without pushing.
|
# Pull requests: build, test and build the image without pushing.
|
||||||
# Push to master (direct or merged PR) or a manual run on master: release.
|
# Push to master (direct or merged PR) or a manual run on master: release.
|
||||||
# GitVersion picks the next version (patch by default, "+semver: minor|major" in a commit message for more),
|
# GitVersion picks the next version (patch by default, "+semver: minor|major" in a commit message for more),
|
||||||
# the image is pushed as <version> and latest, and the git tag v<version> is pushed so the next release counts from it.
|
# the image is pushed as <version> and latest, and the git tag v<version> is pushed so the next release counts from it.
|
||||||
# Argo CD Image Updater (infrastructure repo) deploys the newest <version>; nothing is committed back.
|
# Argo CD Image Updater (infrastructure repo) deploys the newest <version>; nothing is committed back.
|
||||||
|
# Releases run one at a time because the runner runs one job at a time (capacity 1), so each one
|
||||||
|
# computes its version after the previous one pushed its tag.
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master]
|
branches: [master]
|
||||||
@@ -13,13 +16,8 @@ on:
|
|||||||
branches: [master]
|
branches: [master]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# Releases run one at a time, so each one computes its version after the previous one pushed its tag.
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || 'release' }}
|
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE: ghcr.io/greboh/hearth-api
|
IMAGE: git.greboh.dev/greboh/hearth-api
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -50,7 +48,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
packages: write
|
|
||||||
env:
|
env:
|
||||||
RELEASE: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
|
RELEASE: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
|
||||||
steps:
|
steps:
|
||||||
@@ -62,13 +59,14 @@ jobs:
|
|||||||
versionSpec: 6.x
|
versionSpec: 6.x
|
||||||
- id: gitversion
|
- id: gitversion
|
||||||
uses: gittools/actions/gitversion/execute@v4
|
uses: gittools/actions/gitversion/execute@v4
|
||||||
- uses: docker/setup-buildx-action@v3
|
# The built-in token cannot push to the package registry; REGISTRY_TOKEN is a personal access token with write:package.
|
||||||
- uses: docker/login-action@v3
|
- uses: docker/login-action@v3
|
||||||
if: env.RELEASE == 'true'
|
if: env.RELEASE == 'true'
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: git.greboh.dev
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
# Default docker builder on the runner's Docker-in-Docker daemon: its layer cache carries over between jobs.
|
||||||
- uses: docker/build-push-action@v6
|
- uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -76,8 +74,6 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
${{ env.IMAGE }}:${{ steps.gitversion.outputs.majorMinorPatch }}
|
${{ env.IMAGE }}:${{ steps.gitversion.outputs.majorMinorPatch }}
|
||||||
${{ env.IMAGE }}:latest
|
${{ env.IMAGE }}:latest
|
||||||
cache-from: type=gha,scope=api
|
|
||||||
cache-to: type=gha,mode=max,scope=api
|
|
||||||
- name: Push release tag
|
- name: Push release tag
|
||||||
if: env.RELEASE == 'true'
|
if: env.RELEASE == 'true'
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: api
|
- name: api
|
||||||
image: ghcr.io/greboh/hearth-api
|
image: git.greboh.dev/greboh/hearth-api
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
|
|||||||
Reference in new issue
Block a user