From b600862ef6dc8a7a0c32480025d647f3edf09d97 Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Fri, 7 Jun 2024 13:33:15 +0200 Subject: [PATCH] Use reusable workflow to build the release --- .github/workflows/build-push-docker-image.yml | 67 ------------------- .github/workflows/release.yml | 12 ++++ .github/workflows/tag-release.yml | 49 -------------- 3 files changed, 12 insertions(+), 116 deletions(-) delete mode 100644 .github/workflows/build-push-docker-image.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/tag-release.yml diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml deleted file mode 100644 index 6ca92d4c..00000000 --- a/.github/workflows/build-push-docker-image.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: build-push-docker-image - -on: - workflow_dispatch: - -jobs: - build-push-docker-image: - runs-on: ubuntu-latest - permissions: - packages: write - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - tags: true - - - name: Get the latest release - id: release - uses: robinraju/release-downloader@v1.7 - with: - latest: true - tag: "${{ github.ref_name }}" - - - name: Get commit details for the tag from the latest release - id: commit_details - run: | - echo "sha=$(git rev-list -n 1 ${{ steps.release.outputs.tag_name }})" >> $GITHUB_OUTPUT - echo "commit_time=$(git show -s --format=%ci ${{ steps.release.outputs.tag_name }})" >> $GITHUB_OUTPUT - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set docker labels and tags - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/openconext/stepup-selfservice/stepup-selfservice - tags: | - type=ref,event=tag - type=semver,pattern={{version}} - type=sha - type=raw,value=prod - - - name: Build and push the Production image - uses: docker/build-push-action@v5 - with: - context: . - build-args: | - APP_VERSION=${{ steps.release.outputs.tag_name }} - GIT_SHA=${{ steps.commit_details.outputs.sha }} - GIT_COMMIT_TIME=${{ steps.commit_details.outputs.commit_time }} - file: docker/Dockerfile.prod - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..5c995df9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,12 @@ +name: release + +on: + push: + tags: + - "*.*.*" + +jobs: + build-release-and-push-container: + uses: openconext/openconext-githubactions/.github/workflows/symfony-release.yml@main + with: + component_name: "Stepup-SelfService" diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml deleted file mode 100644 index e419c331..00000000 --- a/.github/workflows/tag-release.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: tag-release -on: - push: - tags: - - "*.*.*" -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 10 - env: - COMPONENT_NAME: Stepup-SelfService - if: always() - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - repository: OpenConext/Stepup-Build - - - name: Output the semver tag to the tag variable - id: vars - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - - - name: Run release script - run: ./stepup-build.sh ${COMPONENT_NAME} --tag ${{ steps.vars.outputs.tag }} - - - name: Grab the archive filename - id: archive - run: | - echo "archive=$(find . -maxdepth 1 -name "$COMPONENT_NAME*.tar.bz2" -printf '%f\n')" >> $GITHUB_OUTPUT - echo "shasum=$(find . -maxdepth 1 -name "$COMPONENT_NAME*.sha" -printf '%f\n')" >> $GITHUB_OUTPUT - - - name: Release - uses: softprops/action-gh-release@v2 - with: - files: | - ${{ steps.archive.outputs.archive }} - ${{ steps.archive.outputs.shasum }} - token: ${{ secrets.GITHUB_TOKEN }} - fail_on_unmatched_files: true - generate_release_notes: true - - after_build: - needs: build - runs-on: ubuntu-latest - steps: - - name: Trigger Docker container build - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: build-push-docker-image.yml