Skip to content

Create Release

Create Release #190

name: Create Release
on:
workflow_dispatch:
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
- name: Check status of the last run of the test workflow
run: |
gh auth login --with-token <<< "${{ secrets.GH_BOT_ACCESS_TOKEN }}"
conclusion=$(gh run list \
--workflow=ci.yml \
-b main \
-e push \
--limit 1 \
--json conclusion \
--jq ".[0].conclusion")
if [[ -z "$conclusion" ]]; then
echo "Could not determine the status of the most recent test run on the main branch. Aborting..."
exit 1
elif [[ "$conclusion" != "success" ]]; then
echo "The last run of the test workflow on the main branch was not successful. Aborting..."
exit 1
fi
- name: Setup git config
run: |
git config user.name "ankihub-addon-bot"
git config user.email "[email protected]"
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install deps
run: |
python -m pip install -r ./requirements/base.txt
- name: Create ankiaddon file
run: |
bash ./scripts/release.sh
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
- name: Declare version variable
id: vars
run: |
echo "::set-output name=version::$(scripts/calver.sh)"
- name: Commit version bump and create tag
run: |
git commit --allow-empty -m "Bump Version to ${{ steps.vars.outputs.version }}"
git push origin main
git tag ${{ steps.vars.outputs.version }}
git push origin ${{ steps.vars.outputs.version }}
- name: Create github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.vars.outputs.version }}
files: ankihub.ankiaddon
upload-to-ankiweb:
needs: create-release
uses: ./.github/workflows/upload_to_ankiweb.yml
secrets: inherit
upload_to-s3:
needs: create-release
uses: ./.github/workflows/upload_to_s3.yml
secrets: inherit