Release #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_run: | |
| workflows: | |
| - Release Gate | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Release tag to publish (for example: 0.1.5)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| packages: write | |
| actions: read | |
| jobs: | |
| release: | |
| if: github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| env: | |
| DOCKER_HOST: unix:///var/run/docker.sock | |
| TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: /var/run/docker.sock | |
| TESTCONTAINERS_RYUK_DISABLED: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || inputs.tag }} | |
| fetch-depth: 0 | |
| - name: Resolve release context | |
| id: context | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_run" ]; then | |
| echo "tag_name=${{ github.event.workflow_run.head_branch }}" >> "${GITHUB_OUTPUT}" | |
| echo "target_sha=${{ github.event.workflow_run.head_sha }}" >> "${GITHUB_OUTPUT}" | |
| else | |
| if ! git rev-parse "refs/tags/${{ inputs.tag }}" >/dev/null 2>&1; then | |
| echo "::error::GATE_TAG_NOT_FOUND: tag '${{ inputs.tag }}' not found." | |
| exit 17 | |
| fi | |
| echo "tag_name=${{ inputs.tag }}" >> "${GITHUB_OUTPUT}" | |
| echo "target_sha=$(git rev-list -n 1 "refs/tags/${{ inputs.tag }}")" >> "${GITHUB_OUTPUT}" | |
| fi | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "11" | |
| cache: maven | |
| server-id: github | |
| server-username: GITHUB_ACTOR | |
| server-password: GITHUB_TOKEN | |
| - name: Run release gate checks | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG_NAME: ${{ steps.context.outputs.tag_name }} | |
| TARGET_SHA: ${{ steps.context.outputs.target_sha }} | |
| CI_WORKFLOW_FILE: ci.yml | |
| run: | | |
| chmod +x .github/scripts/release_gate.sh | |
| .github/scripts/release_gate.sh | |
| - name: Build and deploy Maven package | |
| run: mvn -B clean deploy -Dmaven.test.skip=true | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release and upload assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.context.outputs.tag_name }} | |
| name: ${{ steps.context.outputs.tag_name }} | |
| generate_release_notes: true | |
| files: | | |
| target/FlexDBLink.jar | |
| target/FlexDBLink-exec.jar | |
| target/FlexDBLink-all.jar | |
| target/FlexDBLink-*-all.jar | |
| target/flexdblink-*-all.jar | |
| target/FlexDBLink-sources.jar | |
| target/FlexDBLink-distribution.zip |