Create release #143
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: Create release | |
on: | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: ghcr.io/mach-composer/mach-composer | |
jobs: | |
goreleaser: | |
# We don't want ubuntu-24-4 yet, because it is missing some packages | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Get goreleaser app token | |
id: get-app-token | |
uses: labd/action-gh-app-token@main | |
with: | |
app-id: ${{ secrets.MCI_APP_ID }} | |
private-key: ${{ secrets.MCI_APP_PRIVATE_KEY }} | |
installation-id: ${{ secrets.MCI_APP_INSTALLATION_ID }} | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Set up Task | |
uses: arduino/setup-task@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install chocolatey | |
run: | | |
mkdir -p /opt/chocolatey | |
wget -q -O - "https://github.com/chocolatey/choco/releases/download/${CHOCOLATEY_VERSION}/chocolatey.v${CHOCOLATEY_VERSION}.tar.gz" | tar -xz -C "/opt/chocolatey" | |
echo '#!/bin/bash' >> /usr/local/bin/choco | |
echo 'mono /opt/chocolatey/choco.exe $@' >> /usr/local/bin/choco | |
chmod +x /usr/local/bin/choco | |
env: | |
CHOCOLATEY_VERSION: 1.2.1 | |
- name: Set up nix | |
uses: cachix/install-nix-action@v30 | |
- name: Get the latest version | |
id: latest | |
uses: miniscruff/changie-action@v2 | |
with: | |
version: latest | |
args: latest | |
- name: Add env vars | |
run: | | |
echo GORELEASER_CURRENT_TAG=${{ steps.latest.outputs.output }}>> $GITHUB_ENV | |
echo RELEASE_NOTES_PATH=.changes/${{ steps.latest.outputs.output }}.md >> $GITHUB_ENV | |
- name: Create release | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
args: --clean --release-notes=${{ env.RELEASE_NOTES_PATH }} --skip=validate | |
env: | |
GORELEASER_CURRENT_TAG: ${{ env.GORELEASER_CURRENT_TAG }} | |
GITHUB_TOKEN: ${{ steps.get-app-token.outputs.app-token }} | |
GOPATH: ${{ env.GOPATH }} | |
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }} | |
- name: Upload release | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mach-composer | |
path: dist/* | |
docker: | |
needs: [ goreleaser ] | |
name: Build and push docker image | |
env: | |
DEFAULT_TERRAFORM: "1.3.10" | |
strategy: | |
matrix: | |
terraform: [ "0.14.11", "1.1.9", "1.2.9", "1.3.10", "1.4.7", "1.5.7" ] | |
cloud: [ "gcp", "aws", "azure", "all" ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set flavor | |
id: flavor | |
run: | | |
TERRAFORM_VERSION=${{ matrix.terraform }} | |
TERRAFORM=${TERRAFORM_VERSION%.*} | |
SUFFIX="" | |
if [ "${{ matrix.cloud }}" != "all" ]; then | |
SUFFIX="-${{ matrix.cloud }}" | |
fi | |
if [ "${TERRAFORM}" != "${DEFAULT_TERRAFORM}" ]; then | |
SUFFIX="${SUFFIX}-tf${TERRAFORM}" | |
fi | |
echo "FLAVOR=${SUFFIX}" >> $GITHUB_OUTPUT | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
suffix=${{ steps.flavor.outputs.FLAVOR }} | |
latest=false | |
images: ${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/bake-action@v5 | |
with: | |
files: | | |
./docker-bake.hcl | |
${{ steps.meta.outputs.bake-file }} | |
targets: default-${{ matrix.cloud }} | |
set: | | |
base.args.TERRAFORM_VERSION=${{ matrix.terraform }} | |
push: true | |
docker-cli: | |
needs: [ goreleaser ] | |
name: Build and push docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
suffix=-cli | |
images: ${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/bake-action@v5 | |
with: | |
files: | | |
./docker-bake.hcl | |
${{ steps.meta.outputs.bake-file }} | |
targets: cli | |
push: true | |
documentation: | |
uses: ./.github/workflows/docs.yml | |
needs: [ docker-cli, docker ] | |
secrets: inherit |