Create Release #284
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Release | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }} | |
| - name: Check status of the last run of the test workflow | |
| run: | | |
| gh auth login --with-token <<< "${{ secrets.WORKFLOW_GIT_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: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: ".python-version" | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: lts/* | |
| - name: Install deps | |
| run: | | |
| uv sync --locked --dev --group aqt | |
| - 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: Update version in pyproject.toml | |
| run: | | |
| version_with_dots=$(echo "${{ steps.vars.outputs.version }}" | sed 's/-/./g') | |
| sed -i "s/^version = \".*\"/version = \"$version_with_dots\"/" pyproject.toml | |
| - name: Commit version bump and create tag | |
| run: | | |
| uv sync | |
| git config --global user.name gh | |
| git config --global user.email "gh@users.noreply.github.com" | |
| git add pyproject.toml | |
| git add uv.lock | |
| git commit -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 |