This commit is contained in:
Shish 2024-04-13 23:30:41 +01:00 committed by Shish
parent a133e7f655
commit 071ec7aa23
2 changed files with 32 additions and 51 deletions

View file

@ -1,51 +0,0 @@
name: Publish
on:
workflow_run:
workflows: Tests
branches:
- main
- master
types: completed
workflow_dispatch:
push:
branches:
- 'branch-2.*'
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
steps:
- name: Checkout triggering commit
if: ${{ github.event_name == 'workflow_run' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-tags: true
fetch-depth: 0
- name: Checkout main commit
if: ${{ github.event_name != 'workflow_run' }}
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- name: Set build vars
run: |
echo "BUILD_TIME=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
echo "BUILD_HASH=$GITHUB_SHA" >> $GITHUB_ENV
- name: Get tags
id: get-tags
shell: bash
run: ./.github/get-tags.py >> $GITHUB_OUTPUT
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@main
with:
name: shish2k/shimmie2
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
cache: ${{ github.event_name != 'schedule' }}
buildoptions: "--build-arg RUN_TESTS=false"
buildargs: BUILD_TIME,BUILD_HASH
tags: "${{ steps.get-tags.outputs.tags }}"

View file

@ -138,3 +138,35 @@ jobs:
run: composer install --no-progress
- name: Run test suite
run: composer test
publish:
name: Publish
runs-on: ubuntu-latest
needs:
- format
- static
- upgrade
- test
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/branch-2')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- name: Set build vars
id: get-vars
run: |
echo "BUILD_TIME=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
echo "BUILD_HASH=$GITHUB_SHA" >> $GITHUB_ENV
./.github/get-tags.py | tee -a $GITHUB_OUTPUT
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@main
with:
name: shish2k/shimmie2
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
cache: ${{ github.event_name != 'schedule' }}
buildoptions: "--build-arg RUN_TESTS=false"
buildargs: BUILD_TIME,BUILD_HASH
tags: "${{ steps.get-vars.outputs.tags }}"