Github Actions: Build image and push to GHCR
All checks were successful
/ build (push) Successful in 1m6s
All checks were successful
/ build (push) Successful in 1m6s
This commit is contained in:
parent
dc9310e5d4
commit
5bb1c61647
39
.gitea/workflows/build.yaml
Normal file
39
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
GHCR_ORG: gansejunge
|
||||
IMAGE_NAME: app-notifications-service-docker-repository-query
|
||||
IMAGE_PATH: ghcr.io/gansejunge/app-notifications-service-docker-repository-query
|
||||
OPS_ORG: notifier
|
||||
OPS_REPO: ops-deployment
|
||||
OPS_BRANCH_BASE: main
|
||||
OPS_PATH: service-docker-repository-query/deployment.yaml
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to GHCR
|
||||
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
|
||||
|
||||
- name: Get Latest Tag
|
||||
id: get_tag
|
||||
run: |
|
||||
BASE64_TOKEN=$(echo "${{ secrets.GHCR_TOKEN }}" | base64)
|
||||
LATEST_TAG=$(curl -s -H "Authorization: Bearer $BASE64_TOKEN" \
|
||||
https://ghcr.io/v2/${{ env.GHCR_ORG }}/${{ env.IMAGE_NAME }}/tags/list \
|
||||
| jq -r '.tags | map(select(test("^[0-9]+$"))) | map(tonumber) | max // 0')
|
||||
NEXT_TAG=$((LATEST_TAG + 1))
|
||||
echo "latest=$LATEST_TAG" >> $GITHUB_OUTPUT
|
||||
echo "next=$NEXT_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and Push Docker Image
|
||||
run: |
|
||||
docker build -t ghcr.io/gansejunge/${{ env.IMAGE_NAME }}:${{ steps.get_tag.outputs.next }} .
|
||||
docker push ghcr.io/gansejunge/${{ env.IMAGE_NAME }}:${{ steps.get_tag.outputs.next }}
|
||||
Loading…
x
Reference in New Issue
Block a user