From 6d0233aaa2a93b062333439c3e1077e8661e1079 Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Thu, 23 May 2024 11:44:57 +0200 Subject: [PATCH 1/2] Use reusable workflow to build the release --- .github/workflows/build-push-docker-image.yml | 44 ----------- .github/workflows/release.yml | 12 +++ .github/workflows/tag-release.yml | 75 ------------------- component_info | 2 +- 4 files changed, 13 insertions(+), 120 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 42bfb36..0000000 --- a/.github/workflows/build-push-docker-image.yml +++ /dev/null @@ -1,44 +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 - - - name: Get the latest release - id: release - uses: robinraju/release-downloader@v1.7 - with: - latest: true - fileName: "*.tar.bz2" - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push the Production image - uses: docker/build-push-action@v4 - with: - context: . - file: docker/Dockerfile.prod - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/openconext/stepup-gssp-example/stepup-gssp-example:prod - ghcr.io/openconext/stepup-gssp-example/stepup-gssp-example:${{ github.sha }} - ghcr.io/openconext/stepup-gssp-example/stepup-gssp-example:${{ steps.release.outputs.tag_name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..aaa52a0 --- /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-gssp-example" diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml deleted file mode 100644 index 10462f0..0000000 --- a/.github/workflows/tag-release.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: tag-release - -on: - push: - tags: - - "*.*.*" - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 10 - env: - COMPONENT_NAME: Stepup-gssp-example - if: always() - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - repository: OpenConext/Stepup-Build - ref: feature/php82_build - - name: Output the semver tag to the tag variable - id: vars - run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} - - name: Run release script - run: ./stepup-build.sh ${COMPONENT_NAME} --tag ${{ steps.vars.outputs.tag }} - - name: Grab the archive filename - id: archive - run: | - echo ::set-output name=archive::$(find . -maxdepth 1 -name "$COMPONENT_NAME*.tar.bz2" -printf '%f\n') - echo ::set-output name=shasum::$(find . -maxdepth 1 -name "$COMPONENT_NAME*.sha" -printf '%f\n') - - name: Create Draft Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.vars.outputs.tag }} - release_name: ${{ steps.vars.outputs.tag }} - body: Auto generated release. Please update these release notes manually. - draft: true - prerelease: false - - uses: actions/upload-release-asset@v1.0.1 - name: Upload the release artefact tarbal - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ steps.archive.outputs.archive }} - asset_name: ${{ steps.archive.outputs.archive }} - asset_content_type: application/gzip - - uses: actions/upload-release-asset@v1.0.1 - name: Upload the release artefact verification shasum - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ steps.archive.outputs.shasum }} - asset_name: ${{ steps.archive.outputs.shasum }} - asset_content_type: text/plain - - uses: eregon/publish-release@v1 - name: Publish the new release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - release_id: ${{ steps.create_release.outputs.id }} - - 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 - diff --git a/component_info b/component_info index 490b68b..f86f8bc 100644 --- a/component_info +++ b/component_info @@ -2,5 +2,5 @@ PHP_VERSION=82 SYMFONY_VERSION=4 ENCORE=yes ASSETIC=no -NODE_VERSION=14 +NODE_VERSION=20 TEST_EXTRA_DIRS="dev/ tests/ ci/" From 3912e8472486549b8ac005bf9122e2db408a287f Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Thu, 23 May 2024 14:35:47 +0200 Subject: [PATCH 2/2] Build and release test image: Use worflow from central repo --- .../build-push-test-docker-image.yml | 56 ++----------------- 1 file changed, 5 insertions(+), 51 deletions(-) diff --git a/.github/workflows/build-push-test-docker-image.yml b/.github/workflows/build-push-test-docker-image.yml index 97ed045..85d73de 100644 --- a/.github/workflows/build-push-test-docker-image.yml +++ b/.github/workflows/build-push-test-docker-image.yml @@ -1,57 +1,11 @@ name: build-push-test-docker-image on: - push: - branches: feature/build-and-publish-test-container workflow_dispatch: jobs: - build-push-test-docker-image: - runs-on: ubuntu-latest - permissions: - packages: write - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Build the app - uses: openconext/build-and-publish-test-container/php82-node20@main - with: - use_yarn: true - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - 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-gssp-example/stepup-gssp-example - flavor: | - latest=false - suffix=-test - tags: | - type=ref,event=tag - type=semver,pattern={{version}} - type=sha - type=raw,suffix=,value=test - - - name: Build and push the TEST image - uses: docker/build-push-action@v4 - with: - context: . - file: docker/Dockerfile.test - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + build-release-and-push-test-image: + uses: openconext/openconext-githubactions/.github/workflows/build-push-test-docker-image.yml@main + with: + component_name: "Stepup-gssp-example" + use_yarn: true