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' }} IMAGE_NAME: ${{ github.event_name == 'release' && 'brewery' || 'brewery-staging' }}
jobs: jobs:
push_package: build_log_output-server:
if: ${{ github.event_name == 'release' || (github.event_name == 'push' && !contains(github.event.head_commit.message, '#no-deploy')) }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build image - name: Extract Docker image metadata
run: docker build . --file Dockerfile.self-host --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
- name: Log in to registry - name: Log in to Docker Hub
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin uses: docker/login-action@v3
# with:
- name: Push image username: ${{ vars.DOCKER_USERNAME }}
run: | password: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# This changes all uppercase characters to lowercase. - name: Set up Docker Buildx
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') uses: docker/setup-buildx-action@v3
# This strips the git ref prefix from the version. - name: Build and push Docker image (server)
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') uses: docker/build-push-action@v6
with:
# This strips the "v" prefix from the tag name. context: "{{defaultContext}}"
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') target: server
push: ${{ github.event_name != 'pull_request' }}
VERSION=latest tags: ${{ steps.meta.outputs.tags }}
echo IMAGE_ID=$IMAGE_ID annotations: ${{ steps.meta.outputs.annotations }}
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
+2
View File
@@ -36,3 +36,5 @@
vendor vendor
coverage coverage
.env
-1
View File
@@ -63,7 +63,6 @@ USER rails:rails
ENV RAILS_LOG_TO_STDOUT="1" \ ENV RAILS_LOG_TO_STDOUT="1" \
RAILS_SERVE_STATIC_FILES="true" RAILS_SERVE_STATIC_FILES="true"
# Entrypoint prepares the database. # Entrypoint prepares the database.
ENTRYPOINT ["/rails/docker-entrypoint.sh"] ENTRYPOINT ["/rails/docker-entrypoint.sh"]