feat: release workflow #8
Workflow file for this run
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: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| version-override: | |
| type: string | |
| required: false | |
| description: 'Optionally specify a custom release version (minor version bump e.g.)' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Resolve version | |
| id: resolve-version | |
| run: | | |
| if [ -n "${{ inputs.version-override }}" ]; then | |
| echo "NEW_VERSION=${{ inputs.version-override }}" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| CURRENT_VERSION=$(git tag --sort=-creatordate | head -n 1) | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" | |
| PATCH=$((PATCH + 1)) | |
| RESOLVED_VERSION="$MAJOR.$MINOR.$PATCH" | |
| echo "NEW_VERSION=$RESOLVED_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Configure git | |
| run: | | |
| git config user.name aws-sdk-kotlin-ci | |
| git config user.email "[email protected]" | |
| - name: Create tag | |
| env: | |
| NEW_VERSION: ${{ steps.resolve-version.outputs.NEW_VERSION }} | |
| run: | | |
| git tag "$NEW_VERSION" | |
| git push origin "$NEW_VERSION" | |
| - name: Run release | |
| env: | |
| RELEASE_BUCKET: ${{ secrets.RELEASE_BUCKET }} | |
| PUBLISHING_ROLE_ARN: ${{ secrets.PUBLISHING_ROLE_ARN }} | |
| run: | | |
| exit 1 | |
| ./scripts/release.sh | |
| - name: Delete failed release tag | |
| if: ${{ failure() }} | |
| run: | | |
| exit 0 | |
| git push --delete origin ${{ steps.resolve-version.outputs.NEW_VERSION }} |