Release #11
This file contains 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: Release | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'server/**' | |
- 'src/**' | |
- 'index.html' | |
workflow_dispatch: ~ | |
permissions: | |
contents: write | |
jobs: | |
tests: | |
name: "Run tests" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install ruff pytest | |
if [ -f server/requirements.txt ]; then pip install -r server/requirements.txt; fi | |
# - name: Test with pytest | |
# run: | | |
# pytest --doctest-modules --junitxml=junit/test-results.xml | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.changelog.outputs.version }} | |
tag: ${{ steps.changelog.outputs.tag }} | |
changelog: ${{ steps.changelog.outputs.changelog }} | |
clean_changelog: ${{ steps.changelog.outputs.clean_changelog }} | |
skipped: ${{ steps.changelog.outputs.skipped }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Conventional Changelog Action | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v5 | |
with: | |
release-count: '1' | |
skip-version-file: 'true' | |
skip-commit: 'true' | |
skip-git-pull: 'true' | |
git-push: 'false' | |
fallback-version: '0.1.0' | |
release: | |
name: "Release and publish the version" | |
needs: [ tests, version ] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract repository name | |
run: echo "REPOSITORY=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ghcr.io/${{ env.REPOSITORY }}:${{ needs.version.outputs.version }} | |
- name: Update changelog | |
shell: bash | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
touch CHANGELOG.md | |
echo -e "${{ needs.version.outputs.changelog }}\n\n$(cat CHANGELOG.md)" > CHANGELOG.md | |
git add CHANGELOG.md | |
git add docs/reference.md | |
git commit -m "chore(release): ${{ needs.version.outputs.version }}" CHANGELOG.md | |
git push | |
- name: Tag | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{ needs.version.outputs.tag }}', | |
sha: context.sha | |
}) | |
- name: Release on GitHub | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.version.outputs.tag }} | |
files: dist/* | |
body: | | |
Released to ghcr.io/${{ env.REPOSITORY }}:${{ needs.version.outputs.version }} | |
--- | |
${{ needs.version.outputs.clean_changelog }} | |
prerelease: ${{ inputs.prerelease }} | |
name: Version ${{ needs.version.outputs.version }} | |
generate_release_notes: false |