mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-04-30 16:03:37 -04:00
95 lines
2.8 KiB
YAML
95 lines
2.8 KiB
YAML
name: release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- 'v[0-9]+.[0-9]+.[0-9]+*'
|
|
|
|
jobs:
|
|
release:
|
|
name: Release
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Set up QEMU cross build support
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v2
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Fetch tags
|
|
run: git fetch --force --tags
|
|
|
|
- name: Compare versions
|
|
run: ./.github/scripts/compare-release-version.sh
|
|
|
|
- name: Determine Go version
|
|
id: go
|
|
uses: ./.github/actions/go-version
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: ${{ steps.go.outputs.version }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Install cosign
|
|
uses: sigstore/cosign-installer@main
|
|
with:
|
|
cosign-release: v2.2.0
|
|
|
|
- name: Setup snapcraft
|
|
run: |
|
|
sudo snap install snapcraft --classic --channel=7.x/stable
|
|
|
|
# See https://github.com/goreleaser/goreleaser/issues/1715
|
|
mkdir -p "$HOME/.cache/snapcraft/download"
|
|
mkdir -p "$HOME/.cache/snapcraft/stage-packages"
|
|
env:
|
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_TOKEN }}
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v4
|
|
with:
|
|
version: v1.21.2
|
|
args: release --clean --timeout=60m --snapshot=${{ !startsWith(github.ref, 'refs/tags/v') }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_TOKEN }}
|
|
- name: Upload Debian packages to PackageCloud
|
|
uses: computology/packagecloud-github-action@v0.6
|
|
with:
|
|
PACKAGE-NAME: dist/*.deb
|
|
PACKAGECLOUD-USERNAME: opentofu
|
|
PACKAGECLOUD-REPONAME: tofu
|
|
PACKAGECLOUD-DISTRO: any/any
|
|
PACKAGECLOUD-TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
|
|
- name: Upload RPM packages to PackageCloud
|
|
uses: computology/packagecloud-github-action@v0.6
|
|
with:
|
|
PACKAGE-NAME: dist/*.rpm
|
|
PACKAGECLOUD-USERNAME: opentofu
|
|
PACKAGECLOUD-REPONAME: tofu
|
|
PACKAGECLOUD-DISTRO: rpm_any/rpm_any
|
|
PACKAGECLOUD-TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
|