Skip to content

Release Automation #193

Release Automation

Release Automation #193

Workflow file for this run

---
name: Release Automation
on:
workflow_run:
workflows: ["Test"]
types:
- completed
jobs:
release_options:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'develop')
outputs:
release_options: ${{ steps.release_options.outputs.release_options }}
steps:
- id: release_options
name: Release options
run: |
release_options="--git.tagExclude='*[-]*'"
branch=${{ github.event.workflow_run.head_branch }}
if [ -n "$branch" ] && [ "$branch" = "develop" ]; then
release_options="--preRelease=beta"
fi
echo "release_options=$release_options" >> "$GITHUB_OUTPUT"
release:
runs-on: ubuntu-latest
needs: release_options
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_branch }}
- name: Build the Image
run: docker build --tag ghcr.io/${{ github.repository }}:${{ github.sha }} .
- name: Running release
run: |
docker run \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
-e GIT_DIRECTORY="/app" \
-e GIT_EMAIL=${GIT_EMAIL} \
-e GIT_USERNAME="${GIT_USERNAME}" \
-e GPG_PRIVATE_KEY="${GPG_PRIVATE_KEY}" \
-e GPG_PRIVATE_KEY_ID="${GPG_PRIVATE_KEY_ID}" \
-e RELEASE_IT_PLUGINS="@release-it/conventional-changelog@latest,@release-it/bumper@latest" \
-e SSH_PRIVATE_KEY="${SSH_PRIVATE_KEY}" \
-u root \
-v $PWD:/app \
ghcr.io/${{ github.repository }}:${{ github.sha }} \
release-it --ci ${{needs.release_options.outputs.release_options}}
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_GITHUB_TOKEN }}
GIT_EMAIL: ${{ vars.GIT_EMAIL }}
GIT_USERNAME: ${{ vars.GIT_USERNAME }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}