|
| 1 | +name: Create beta release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + next: |
| 7 | + description: 'The next increment to create the release for' |
| 8 | + required: true |
| 9 | + default: 'minor' |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - major |
| 13 | + - minor |
| 14 | + |
| 15 | +jobs: |
| 16 | + goreleaser: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Check out code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - name: Fetch tags |
| 25 | + run: git fetch --force --tags |
| 26 | + |
| 27 | + - name: Set up Go |
| 28 | + uses: actions/setup-go@v4 |
| 29 | + with: |
| 30 | + go-version-file: go.mod |
| 31 | + |
| 32 | + - name: Get goreleaser app token |
| 33 | + id: get-app-token |
| 34 | + uses: labd/action-gh-app-token@main |
| 35 | + with: |
| 36 | + app-id: ${{ secrets.MCI_APP_ID }} |
| 37 | + private-key: ${{ secrets.MCI_APP_PRIVATE_KEY }} |
| 38 | + installation-id: ${{ secrets.MCI_APP_INSTALLATION_ID }} |
| 39 | + |
| 40 | + - name: Get hash |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + HASH=$(git rev-parse --short "$GITHUB_SHA") |
| 44 | + echo "HASH=$HASH" >> $GITHUB_ENV |
| 45 | +
|
| 46 | + - name: Get the next potential version |
| 47 | + id: next-tag |
| 48 | + uses: miniscruff/changie-action@v2 |
| 49 | + with: |
| 50 | + version: latest |
| 51 | + args: next -p beta-${{ env.HASH }} ${{ github.event.inputs.next }} |
| 52 | + |
| 53 | + - name: Output changes |
| 54 | + uses: miniscruff/changie-action@v2 |
| 55 | + id: changelog |
| 56 | + with: |
| 57 | + version: latest |
| 58 | + args: batch --dry-run -p beta-${{ env.HASH }} ${{ github.event.inputs.next }} |
| 59 | + |
| 60 | + - name: Save ChangeLog to file |
| 61 | + id: save_changes |
| 62 | + run: | |
| 63 | + tmpfile=$(mktemp) |
| 64 | + echo "${{ steps.changelog.outputs.output }}" > $tmpfile |
| 65 | + echo "changelog_file=$tmpfile" >> $GITHUB_OUTPUT |
| 66 | + shell: bash |
| 67 | + |
| 68 | + - name: GoReleaser |
| 69 | + uses: goreleaser/goreleaser-action@v5 |
| 70 | + with: |
| 71 | + args: release --clean --skip=validate --release-notes ${{ steps.save_changes.outputs.changelog_file }} |
| 72 | + env: |
| 73 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + GOPATH: ${{ env.GOPATH }} |
| 75 | + GORELEASER_CURRENT_TAG: ${{ steps.next-tag.outputs.output }} |
| 76 | + PRERELEASE: true |
0 commit comments