|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + goreleaser: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + with: |
| 14 | + fetch-depth: 0 |
| 15 | + |
| 16 | + - name: Determine Go version from go.mod |
| 17 | + run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV |
| 18 | + |
| 19 | + - uses: actions/setup-go@v4 |
| 20 | + with: |
| 21 | + go-version: ${{ env.GO_VERSION }} |
| 22 | + |
| 23 | + - name: Set up QEMU |
| 24 | + uses: docker/setup-qemu-action@v3 |
| 25 | + |
| 26 | + - name: Set up Docker Buildx |
| 27 | + uses: docker/setup-buildx-action@v3 |
| 28 | + |
| 29 | + - uses: actions/cache@v3 |
| 30 | + with: |
| 31 | + path: ~/go/pkg/mod |
| 32 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 33 | + restore-keys: | |
| 34 | + ${{ runner.os }}-go- |
| 35 | +
|
| 36 | + - name: Login to ghcr.io |
| 37 | + uses: docker/login-action@v3 |
| 38 | + with: |
| 39 | + registry: ghcr.io |
| 40 | + username: ${{ github.repository_owner }} |
| 41 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + |
| 43 | + - name: Build changelog from PRs with labels |
| 44 | + id: build_changelog |
| 45 | + uses: mikepenz/release-changelog-builder-action@v4 |
| 46 | + with: |
| 47 | + configuration: ".github/changelog-configuration.json" |
| 48 | + # PreReleases still get a changelog, but the next full release gets a diff since the last full release, |
| 49 | + # combining possible changelogs of all previous PreReleases in between. |
| 50 | + # PreReleases show a partial changelog since last PreRelease. |
| 51 | + ignorePreReleases: "${{ !contains(github.ref, '-rc') }}" |
| 52 | + outputFile: .github/release-notes.md |
| 53 | + env: |
| 54 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + |
| 56 | + - name: Publish releases |
| 57 | + uses: goreleaser/goreleaser-action@v5 |
| 58 | + with: |
| 59 | + args: release --release-notes .github/release-notes.md |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + REGISTRY: ghcr.io |
| 63 | + IMAGE_NAME: ${{ github.repository }} |
0 commit comments