name: Auto Release
on:
pull_request:
types: [closed]
branches:
- main
jobs:
auto-release:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
environment:
name: huginn
deployment: false
if: >-
github.event.pull_request.merged == true &&
github.event.pull_request.head.ref == 'update-github-languages' &&
github.repository == 'luxass/github-languages-rs' &&
(github.event.pull_request.user.login == 'luxass' || github.event.pull_request.user.login == 'huginn-watch[bot]')
steps:
- name: generate token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true
- run: rustup default stable
- uses: taiki-e/install-action@d858f8113943481093e02986a7586a4819a3bfd6 with:
tool: just,cargo-edit
- name: create tag and release
run: |
CURRENT_VERSION=$(awk -F ' = ' '/^version = / {gsub(/"/, "", $2); print $2; exit}' Cargo.toml)
PATCH_VERSION=$(echo $CURRENT_VERSION | awk -F. '{printf "%d.%d.%d", $1, $2, $3+1}')
echo "detected version: $CURRENT_VERSION"
echo "patched to: $PATCH_VERSION"
git config user.email "273299945+huginn-watch[bot]@users.noreply.github.com"
git config user.name "huginn-watch[bot]"
just release "$PATCH_VERSION"
git push && git push --tags
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}