Automated Release #63
This file contains 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
# SPDX-FileCopyrightText: The terraform-provider-k8s Authors | |
# SPDX-License-Identifier: 0BSD | |
name: Automated Release | |
on: | |
schedule: | |
- cron: 23 6 * * MON | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 | |
permissions: | |
contents: write | |
steps: | |
- id: checkout | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: last_release | |
name: Fetch last release info | |
run: echo "tag=$(gh release view --json tagName --jq '.tagName')" >> $GITHUB_OUTPUT | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: commits | |
name: Count Commits | |
run: echo "count=$(git rev-list --count ${{ steps.last_release.outputs.tag }}..HEAD)" >> $GITHUB_OUTPUT | |
- id: release | |
name: Create Release Version | |
if: steps.commits.outputs.count > 0 | |
run: echo "version=$(date +'%Y.%-m.%-d')" >> $GITHUB_OUTPUT | |
- id: tag | |
name: Create Release Tag | |
if: steps.commits.outputs.count > 0 | |
uses: EndBug/latest-tag@v1 | |
with: | |
ref: ${{ steps.release.outputs.version }} | |
- id: setup_go | |
name: Set up Go | |
uses: actions/setup-go@v5 | |
if: steps.commits.outputs.count > 0 | |
with: | |
go-version-file: go.mod | |
cache: true | |
- id: import_gpg | |
name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
if: steps.commits.outputs.count > 0 | |
with: | |
gpg_private_key: ${{ secrets.GPG_SECRET_KEY_BASE64 }} | |
passphrase: ${{ secrets.GPG_SECRET_KEY_PASSWORD }} | |
- id: goreleaser | |
name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
if: steps.commits.outputs.count > 0 | |
with: | |
version: latest | |
args: release --clean --timeout 120m --parallelism 1 | |
env: | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: mail | |
name: Send Mail | |
if: steps.commits.outputs.count > 0 | |
uses: dawidd6/action-send-mail@v3 | |
with: | |
server_address: ${{ secrets.MAIL_SERVER }} | |
server_port: ${{ secrets.MAIL_PORT }} | |
username: ${{ secrets.MAIL_USERNAME }} | |
password: ${{ secrets.MAIL_PASSWORD }} | |
subject: ${{ github.event.repository.name }} version ${{ steps.release.outputs.version }} published | |
body: See https://github.com/metio/terraform-provider-k8s/releases/tag/${{ steps.release.outputs.version }} for details. | |
to: ${{ secrets.MAIL_RECIPIENT }} | |
from: ${{ secrets.MAIL_SENDER }} | |
- id: matrix | |
name: Send Matrix Message | |
if: steps.commits.outputs.count > 0 | |
uses: s3krit/[email protected] | |
with: | |
room_id: ${{ secrets.MATRIX_ROOM_ID }} | |
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} | |
message: ${{ github.event.repository.name }} version [${{ steps.release.outputs.version }}](https://github.com/metio/terraform-provider-k8s/releases/tag/${{ steps.release.outputs.version }}) published | |
server: ${{ secrets.MATRIX_SERVER }} |