mirror of
https://github.com/terraform-docs/terraform-docs.git
synced 2026-03-27 12:58:35 +07:00
126 lines
3.8 KiB
YAML
126 lines
3.8 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
- "!v*.*.*-*"
|
|
|
|
env:
|
|
GO_VERSION: "1.24.2"
|
|
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
|
|
|
jobs:
|
|
assets:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Generate Contributors list
|
|
id: contributors
|
|
run: |
|
|
make -C .github/scripts contributors NEW_VERSION=${GITHUB_REF:11}
|
|
echo "contributors_list=$(cat .github/scripts/contributors.list | sed -z 's/\n/\\n/g')" >> "$GITHUB_ENV"
|
|
|
|
- name: Login to Docker
|
|
uses: docker/login-action@v3
|
|
if: env.REGISTRY_USERNAME != ''
|
|
with:
|
|
registry: quay.io
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v6
|
|
if: env.REGISTRY_USERNAME != ''
|
|
with:
|
|
distribution: goreleaser
|
|
version: 1.26.2
|
|
args: release --clean --skip=sign
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
|
|
Contributors: ${{ env.contributors_list }}
|
|
|
|
homebrew:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
needs: [assets]
|
|
steps:
|
|
- name: Bump Homebrew formula version
|
|
uses: dawidd6/action-homebrew-bump-formula@v3.11.0
|
|
with:
|
|
token: ${{ secrets.COMMITTER_TOKEN }}
|
|
formula: terraform-docs
|
|
|
|
chocolatey:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
needs: [assets]
|
|
steps:
|
|
- name: Update Chocolatey package
|
|
run: |
|
|
# get closest GA tag, ignore alpha, beta and rc tags
|
|
function getClosestVersion() {
|
|
for t in $(git tag --sort=-creatordate); do
|
|
tag="$t"
|
|
if [[ "$tag" == *"-alpha"* ]] || [[ "$tag" == *"-beta"* ]] || [[ "$tag" == *"-rc"* ]]; then
|
|
continue
|
|
fi
|
|
if [ "$tag" == "${GITHUB_REF:11}" ]; then
|
|
continue
|
|
fi
|
|
break
|
|
done
|
|
echo "${tag//v/}"
|
|
}
|
|
CLOSEST_VERSION=$(getClosestVersion)
|
|
|
|
curl -L \
|
|
-X POST \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "Authorization: Bearer ${{ secrets.COMMITTER_TOKEN }}" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/terraform-docs/chocolatey-package/dispatches \
|
|
-d "{\
|
|
\"event_type\": \"trigger-workflow\", \
|
|
\"client_payload\": {\
|
|
\"current-version\": \"${CLOSEST_VERSION}\", \
|
|
\"release-version\": \"${GITHUB_REF:11}\" \
|
|
}\
|
|
}"
|
|
|
|
gh-actions:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
needs: [assets]
|
|
steps:
|
|
- name: Update GitHub Actions
|
|
run: |
|
|
curl -L \
|
|
-X POST \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "Authorization: Bearer ${{ secrets.COMMITTER_TOKEN }}" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
https://api.github.com/repos/terraform-docs/chocolatey-package/dispatches \
|
|
-d "{\
|
|
\"event_type\": \"trigger-workflow\", \
|
|
\"client_payload\": {\
|
|
\"release-version\": \"${GITHUB_REF:11}\" \
|
|
}\
|
|
}"
|