changed github actions to better match other procjects

This commit is contained in:
Aaro Koivukangas
2025-10-06 16:06:49 +03:00
parent 4a40b9040a
commit 8db8dfbf07
3 changed files with 23 additions and 27 deletions
+21 -26
View File
@@ -10,36 +10,31 @@ env:
IMAGE_NAME: ${{ github.event_name == 'release' && 'brewery' || 'brewery-staging' }}
jobs:
push_package:
if: ${{ github.event_name == 'release' || (github.event_name == 'push' && !contains(github.event.head_commit.message, '#no-deploy')) }}
build_log_output-server:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build . --file Dockerfile.self-host --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
- name: Extract Docker image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
#
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# This changes all uppercase characters to lowercase.
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# This strips the git ref prefix from the version.
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# This strips the "v" prefix from the tag name.
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Build and push Docker image (server)
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}"
target: server
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}