Prepare release 0.9.0 #27
Workflow file for this run
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
name: Continuous Delivery | |
on: | |
push: | |
tags: ['v*'] # push events to matching v*, i.e. v1.0, v20.15.10 | |
defaults: | |
run: | |
shell: bash | |
env: | |
PYTHON_DEFAULT_VERSION: '3.12' | |
GO_DEFAULT_VERSION: '1.22' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build-pybindings: | |
runs-on: ${{ matrix.conf.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
conf: | |
- { runner: ubuntu-latest, os: linux, arch: amd64 } | |
- { runner: ubuntu-latest, os: linux, arch: arm64 } | |
- { runner: macos-12, os: darwin, arch: amd64 } | |
- { runner: macos-14, os: darwin, arch: arm64 } | |
- { runner: windows-2019, os: windows, arch: amd64 } | |
outputs: | |
version: ${{ steps.build.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Start a Docker container (linux-arm64) | |
if: matrix.conf.os == 'linux' && matrix.conf.arch == 'arm64' | |
run: | | |
docker run --privileged --rm tonistiigi/binfmt:qemu-v8.0.4 --install arm64 | |
docker run --detach \ | |
--platform linux/arm64 \ | |
--volume .:/work \ | |
--name builder \ | |
arm64v8/python:${{ env.PYTHON_DEFAULT_VERSION }}-bullseye \ | |
/bin/bash -c "sleep infinity" | |
- name: Start a Docker container (linux-amd64) | |
if: matrix.conf.os == 'linux' && matrix.conf.arch == 'amd64' | |
run: | | |
docker run --detach \ | |
--volume .:/work \ | |
--name builder \ | |
python:${{ env.PYTHON_DEFAULT_VERSION }}-bullseye \ | |
/bin/bash -c "sleep infinity" | |
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} (darwin, windows) | |
if: matrix.conf.os != 'linux' | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
- name: Define command wrapper (linux) | |
if: matrix.conf.os == 'linux' | |
run: | | |
# We'll define a 'run' command that will run our commands in the container. | |
echo '#!/bin/bash' > run | |
echo 'command="$*"; docker exec --workdir /work/python-bindings builder /bin/bash -c "$command"' >> run | |
chmod +x run | |
sudo mv run /usr/local/bin/run | |
- name: Define command wrapper (darwin) | |
if: matrix.conf.os == 'darwin' | |
run: | | |
# MacOS wrapper just runs commands in python-bindings directory | |
echo '#!/bin/bash' > run | |
echo 'pushd python-bindings; "$@"; popd' >> run | |
chmod +x run | |
sudo mv run /usr/local/bin/run | |
- name: Define command wrapper (windows) | |
if: matrix.conf.os == 'windows' | |
run: | | |
# Windows wrapper just runs commands in python-bindings directory | |
echo '#!/bin/bash' > run | |
echo 'pushd python-bindings; "$@"; popd' >> run | |
chmod +x run | |
mv run /usr/bin/run | |
- name: Install system dependencies (linux) | |
if: matrix.conf.os == 'linux' | |
run: | | |
run apt update -y | |
run apt install scons patchelf libnss3-dev -y | |
- name: Install Python dependencies | |
run: | | |
run make deps | |
- name: Build Python bindings | |
id: build | |
run: | | |
run make build | |
- if: matrix.conf.os == 'linux' | |
run: | | |
sudo chmod -R a+r python-bindings | |
- name: Upload Python bindings | |
uses: actions/upload-artifact@v4 | |
with: | |
name: py-terraform-provider-b2-${{ matrix.conf.os }}-${{ matrix.conf.arch }} | |
path: python-bindings/dist/py-terraform-provider-b2 | |
if-no-files-found: error | |
retention-days: 1 | |
build-and-deploy: | |
needs: [build-pybindings] | |
env: | |
NOPYBINDINGS: 1 # do not build python bindings | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go ${{ env.GO_DEFAULT_VERSION }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_DEFAULT_VERSION }} | |
- name: Install dependencies | |
run: | | |
make deps | |
- name: Download python bindings for all OSes | |
uses: actions/download-artifact@v4 | |
with: | |
path: python-bindings/dist/artifacts/ | |
- name: Postprocess python bindings | |
working-directory: python-bindings/dist | |
run: | | |
mv artifacts/py-terraform-provider-b2-linux-amd64/py-terraform-provider-b2 py-terraform-provider-b2-linux-amd64 | |
mv artifacts/py-terraform-provider-b2-linux-arm64/py-terraform-provider-b2 py-terraform-provider-b2-linux-arm64 | |
mv artifacts/py-terraform-provider-b2-darwin-amd64/py-terraform-provider-b2 py-terraform-provider-b2-darwin-amd64 | |
mv artifacts/py-terraform-provider-b2-darwin-arm64/py-terraform-provider-b2 py-terraform-provider-b2-darwin-arm64 | |
mv artifacts/py-terraform-provider-b2-windows-amd64/py-terraform-provider-b2 py-terraform-provider-b2-windows-amd64 | |
- name: Set release version output | |
id: version | |
run: | | |
tag=${{ github.ref_name }} | |
# Strip the prefix 'v' | |
version=${tag:1} | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Read the Changelog | |
id: read-changelog | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
version: ${{ steps.version.outputs.version }} | |
- name: Import GPG key | |
id: import_gpg | |
uses: paultyng/ghaction-import-gpg@v2 | |
env: | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
PASSPHRASE: ${{ secrets.PASSPHRASE }} | |
- name: Create GitHub release | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: '~> v2' | |
args: release --clean -p 1 | |
env: | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
- name: Update GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: v${{ steps.version.outputs.version }} | |
body: ${{ steps.read-changelog.outputs.changes }} | |
draft: false | |
prerelease: false |