Skip to content

Release

Release #19

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches:
- main
env:
GIT_USER_EMAIL: ${{ secrets.GIT_EMAIL }}
GIT_USER_NAME: ${{ secrets.GIT_NAME }}
permissions:
contents: write
packages: write
jobs:
bump_version:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
runs-on: ubuntu-latest
name: "Bump version"
outputs:
version: ${{ steps.cz.outputs.version }}
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
token: "${{ secrets.ACCESS_TOKEN }}"
ref: "main"
- name: Set up Python
uses: actions/setup-python@v4.7.0
with:
python-version: 3.11
- name: Config Git User
run: |
git config --local user.email "$GIT_USER_EMAIL"
git config --local user.name "$GIT_USER_NAME"
git config --local pull.ff only
- id: cz
name: Create bump and changelog
run: |
python -m pip install -U commitizen
cz bump --yes
export REV=`cz version --project`
echo "version=\"v$REV\"" >> $GITHUB_OUTPUT
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
repository: "Drafteame/ejson-action"
branch: "main"
directory: .
tags: true
- name: Print Version
run: echo "Bumped to version ${{ steps.cz.outputs.version }}"
build:
runs-on: ubuntu-latest
steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and push
run: |
if [ -z "${{ needs.bump_version.outputs.version }}" ]; then
VERSION="latest"
else
VERSION="${{ steps.bump_version.outputs.version }}"
fi
echo "Building version ${VERSION}"
docker buildx build --platform linux/amd64,linux/arm64 -t $(echo 'ghcr.io/${{ github.repository }}:$VERSION' | tr '[:upper:]' '[:lower:]') --push .