Skip to content

Release v2.0.6 (#132) #46

Release v2.0.6 (#132)

Release v2.0.6 (#132) #46

Workflow file for this run

# Name: release.yaml
# Author: Mathew Fleisch <[email protected]>
# Description: This action will build and push a multi-arch docker container,
# cross compile go-binaries and save as release artifacts,
# and package a helm chart as gh-pages env, when triggered by
# pushing a new git tag (that starts with the letter 'v').
name: Release Bashbot
on:
push:
branches:
- main
paths:
- 'charts/**'
jobs:
release:
name: Release Bashbot
runs-on: ubuntu-latest
steps:
-
name: Checkout Bashbot source
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Install stuff with asdf
uses: asdf-vm/actions/install@v2
with:
tool_versions: |
golang 1.19.4
yq 4.30.6
-
name: Set tag environment variable
run: |
echo "RELEASE_VERSION=$(make version)" >> $GITHUB_ENV
echo "RELEASE_VERSION_NO_V=$(make version)" | sed -e 's/v//g' >> $GITHUB_ENV
-
name: Build go-binaries
run: |
make go-setup
make go-cross-compile
echo "Go-Binaries created: $(ls bin -alF)"
-
name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
-
name: Docker Login
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GIT_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository_owner }}/bashbot:latest
ghcr.io/${{ github.repository_owner }}/bashbot:${{ env.RELEASE_VERSION }}
mathewfleisch/bashbot:latest
mathewfleisch/bashbot:${{ env.RELEASE_VERSION }}
cache-from: type=registry,ref=mathewfleisch/bashbot:latest
cache-to: type=inline
-
name: Build and push root container
id: docker_build_root
uses: docker/build-push-action@v4
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository_owner }}/bashbot:latest-root
ghcr.io/${{ github.repository_owner }}/bashbot:${{ env.RELEASE_VERSION }}-root
mathewfleisch/bashbot:latest-root
mathewfleisch/bashbot:${{ env.RELEASE_VERSION }}-root
cache-from: type=registry,ref=mathewfleisch/bashbot:latest
cache-to: type=inline
build-args: NRUSER=root
-
name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
-
name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GIT_TOKEN }}"
CR_SKIP_EXISTING: true
-
name: Cut Github Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GIT_TOKEN }}
allowUpdates: true
artifacts: "bin/*"
tag: bashbot-${{ env.RELEASE_VERSION }}
-
name: Install Bashbot via asdf from release artifacts
uses: asdf-vm/actions/install@v2
with:
tool_versions: bashbot ${{ env.RELEASE_VERSION_NO_V }}
-
name: Notify Release Channel
env:
BASHBOT_CONFIG_FILEPATH: ./config.yaml
SLACK_CHANNEL: C02A1SH4GLT
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_APP_TOKEN: ${{ secrets.SLACK_APP_TOKEN }}
run: |
cat <<EOF > $BASHBOT_CONFIG_FILEPATH
admins:
- trigger: bashbotrelease
appName: Bashbot Releases
userIds:
- "UP3BBQX34"
privateChannelId: "GPFMM5MD2"
logChannelId: "CPJ1NFPL7"
messages: []
tools: []
dependencies: []
EOF
bashbot version
bashbot send-message \
--channel ${SLACK_CHANNEL} \
--msg "Bashbot <https://github.com/mathew-fleisch/bashbot/releases/tag/bashbot-${{ env.RELEASE_VERSION}}|${{ env.RELEASE_VERSION }}> has been released and multi-arch containers have been pushed to <https://hub.docker.com/r/mathewfleisch/bashbot/tags|docker-hub> and <https://github.com/mathew-fleisch/bashbot/pkgs/container/bashbot|ghcr>!"