|
| 1 | +--- |
| 2 | +# |
| 3 | +# PLEASE NOTE: Managed workflow - do not change manually |
| 4 | +# |
| 5 | +name: Release |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + dryRun: |
| 11 | + type: boolean |
| 12 | + description: "Dry-Run" |
| 13 | + default: false |
| 14 | + |
| 15 | +concurrency: |
| 16 | + # only run one publishing at a time to avoid conflicts |
| 17 | + group: publish-${{ github.ref }} |
| 18 | + |
| 19 | +env: |
| 20 | + # renovate: datasource=npm depName=@semantic-release/changelog |
| 21 | + SEMANTIC_RELEASE_CHANGELOG_VERSION: 6.0.3 |
| 22 | + |
| 23 | + # renovate: datasource=npm depName=@semantic-release/git |
| 24 | + SEMANTIC_RELEASE_GIT_VERSION: 10.0.1 |
| 25 | + |
| 26 | + # renovate: datasource=npm depName=conventional-changelog-conventionalcommits |
| 27 | + CONVENTIONAL_CHANGELOG_CONVENTIONALCOMMITS_VERSION: 8.0.0 |
| 28 | + |
| 29 | +jobs: |
| 30 | + release: |
| 31 | + # Only on main repository (don't release on forks) |
| 32 | + if: github.repository_owner == 'wetransform-os' |
| 33 | + |
| 34 | + name: Release |
| 35 | + runs-on: ubuntu-latest |
| 36 | + |
| 37 | + outputs: |
| 38 | + release-published: ${{ steps.release.outputs.new_release_published }} |
| 39 | + release-version: ${{ steps.release.outputs.new_release_version }} |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Determine app token for release |
| 43 | + uses: actions/create-github-app-token@136412a57a7081aa63c935a2cc2918f76c34f514 # v1.11.2 |
| 44 | + id: app-token |
| 45 | + with: |
| 46 | + app-id: ${{ secrets.WE_RELEASE_GITHUB_APP_ID }} |
| 47 | + private-key: ${{ secrets.WE_RELEASE_GITHUB_PRIVATE_KEY }} |
| 48 | + |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 51 | + with: |
| 52 | + token: ${{ steps.app-token.outputs.token }} |
| 53 | + # fetch-depth 0 is required to fetch all tags (and to determine the version based on tags) |
| 54 | + fetch-depth: 0 |
| 55 | + |
| 56 | + - name: Create release configuration file |
| 57 | + if: ${{ hashFiles('.releaserc.yml') == '' }} |
| 58 | + shell: bash |
| 59 | + # TODO rather use a template? |
| 60 | + run: | |
| 61 | + cat <<EOF > .releaserc.yml |
| 62 | + --- |
| 63 | + branches: ${{ github.head_ref || github.ref_name }} |
| 64 | +
|
| 65 | + plugins: |
| 66 | + - - "@semantic-release/commit-analyzer" |
| 67 | + # see https://github.com/semantic-release/commit-analyzer?tab=readme-ov-file#options |
| 68 | + - preset: conventionalcommits |
| 69 | + - - "@semantic-release/release-notes-generator" |
| 70 | + # see https://github.com/semantic-release/release-notes-generator?tab=readme-ov-file#options |
| 71 | + - preset: conventionalcommits |
| 72 | + presetConfig: |
| 73 | + issuePrefixes: ['ING-', 'WGS-', 'SVC-'] |
| 74 | + issueUrlFormat: 'https://wetransform.atlassian.net/browse/{{prefix}}{{id}}' |
| 75 | + parserOpts: |
| 76 | + # https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#referenceactions |
| 77 | + # set to null to reference an issue without action (but will still show it "closes" the issue in the changelog) |
| 78 | + # referenceActions: null |
| 79 | + - "@semantic-release/changelog" |
| 80 | + - - "@semantic-release/git" |
| 81 | + - assets: |
| 82 | + - CHANGELOG.md |
| 83 | + - "@semantic-release/github" |
| 84 | + EOF |
| 85 | +
|
| 86 | + - name: Install NodeJs |
| 87 | + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 |
| 88 | + with: |
| 89 | + node-version: 20 |
| 90 | + |
| 91 | + - name: Release |
| 92 | + id: release |
| 93 | + uses: cycjimmy/semantic-release-action@b1b432f13acb7768e0c8efdec416d363a57546f2 # v4.1.1 |
| 94 | + env: |
| 95 | + # Permissions needed |
| 96 | + # contents: write |
| 97 | + # issues: write |
| 98 | + # pull-requests: write |
| 99 | + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |
| 100 | + GIT_AUTHOR_NAME: wetransform Bot |
| 101 | + GIT_AUTHOR_EMAIL: 113353961+wetransformer@users.noreply.github.com |
| 102 | + GIT_COMMITTER_NAME: wetransform Bot |
| 103 | + GIT_COMMITTER_EMAIL: 113353961+wetransformer@users.noreply.github.com |
| 104 | + RUNNER_DEBUG: 1 |
| 105 | + with: |
| 106 | + dry_run: ${{ inputs.dryRun }} |
| 107 | + semantic_version: 24.2.1 |
| 108 | + |
| 109 | + extra_plugins: |
| 110 | + "@semantic-release/changelog@\ |
| 111 | + ${{ env.SEMANTIC_RELEASE_CHANGELOG_VERSION }} \ |
| 112 | + @semantic-release/git@\ |
| 113 | + ${{ env.SEMANTIC_RELEASE_GIT_VERSION }} \ |
| 114 | + conventional-changelog-conventionalcommits@\ |
| 115 | + ${{ env.CONVENTIONAL_CHANGELOG_CONVENTIONALCOMMITS_VERSION }} \ |
| 116 | + " |
| 117 | + |
| 118 | + # Note: This does not push "latest" tag, only the version tag (it is assumed that latest is pushed before the release with the same content) |
| 119 | + push: |
| 120 | + name: Build and push released Docker image |
| 121 | + needs: [release] |
| 122 | + if: ${{ !inputs.dryRun && needs.release.outputs.release-published != 'false' }} |
| 123 | + |
| 124 | + uses: wetransform/gha-workflows/.github/workflows/dockerfile-publish.yml@ea94f03339afbdd8770e446d3f000c2d366a6fc1 # v3.4.1 |
| 125 | + with: |
| 126 | + checkout-ref: refs/tags/v${{needs.release.outputs.release-version}} # check out release tag |
| 127 | + tag: ${{needs.release.outputs.release-version}} |
| 128 | + image: wetransform/conversion-gdal |
| 129 | + secrets: |
| 130 | + DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} |
| 131 | + DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} |
| 132 | + SLACK_NOTIFICATIONS_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} |
0 commit comments