Skip to content

release

release #34

Workflow file for this run

name: release
on:
workflow_run:
workflows: ["ci"]
branches: [main]
types:
- completed
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: get image metadata
shell: bash
id: meta
run: |
version="$(awk '{print $1}' version)"
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "version=${version}-$(git rev-parse --short=10 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
else
echo "version=${version}" >> $GITHUB_OUTPUT
fi
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/corymurphy/containers/argobot:${{ steps.meta.outputs.version }}
helm:
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: configure git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- uses: azure/setup-helm@v4
- id: package
env:
IS_PULL_REQUEST: "${{ github.ref_name != github.event.repository.default_branch }}"
run: |
version=$(helm show chart charts/argobot | awk '/version/ {print $2}')
name=$(helm show chart charts/argobot | awk '/name/ {print $2}')
if [ "$IS_PULL_REQUEST" = "true" ]; then
version="${version}-$(git rev-parse --short=10 ${{ github.event.pull_request.head.sha }})"
fi
mkdir .packages
helm package charts/argobot --version "${version}" --destination .packages
echo "version=${version}" >> $GITHUB_OUTPUT
echo "package_path=.packages/${name}-${version}.tgz" >> $GITHUB_OUTPUT
echo ${{ github.token }} | helm registry login --username ${{ github.actor }} --password-stdin ghcr.io/corymurphy
helm push ".packages/${name}-${version}.tgz" oci://ghcr.io/corymurphy/helm-charts
github:
runs-on: ubuntu-latest
needs: [docker, helm]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: get release version
if: github.ref_name == github.event.repository.default_branch
run: |
version="$(awk '{print $1}' version)"
echo "version=${version}" >> $GITHUB_ENV
- uses: softprops/action-gh-release@v2
if: github.ref_name == github.event.repository.default_branch
with:
tag_name: ${{ env.version }}