chore: unify naming pattern for containers (#309) #35
Workflow file for this run
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 | |
jobs: | |
pages-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: pdm-project/setup-pdm@v4 | |
with: | |
cache: true | |
python-version: '3.12' | |
- id: pages | |
name: Setup pages | |
uses: actions/configure-pages@v4 | |
- run: env | sort | |
- run: make dev-doc | |
- run: CI_PAGES_URL=${{ steps.pages.outputs.base_url }} make doc | |
- name: Generate release notes | |
run: make release-notes > release-notes.md | |
- name: Upload release notes | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-notes | |
path: release-notes.md | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: public | |
release-publish: | |
needs: pages-build | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download release notes | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-notes | |
- id: prerelease | |
name: Determine prerelease | |
run: | | |
if [[ "${{ github.ref }}" =~ (a|b|rc)(0|[1-9][0-9]*)?$ ]]; then | |
echo "is_prerelease=true" > $GITHUB_OUTPUT | |
else | |
echo "is_prerelease=false" > $GITHUB_OUTPUT | |
fi | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: release-notes.md | |
prerelease: ${{ steps.prerelease.outputs.is_prerelease }} | |
container-publish: | |
needs: release-publish | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
password: ${{ secrets.GITHUB_TOKEN }} | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
- name: Build and push dev container | |
env: | |
SOURCE_DATE_EPOCH: 0 | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
PYTHON_VERSION=${{ matrix.python-version }} | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }} | |
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }},mode=max | |
file: .devcontainer/Dockerfile | |
provenance: false | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} | |
ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }}-${{ github.ref_name }} | |
target: dev | |
- name: Build and push prod container | |
env: | |
SOURCE_DATE_EPOCH: 0 | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
PYTHON_VERSION=${{ matrix.python-version }} | |
PDM_BUILD_SCM_VERSION=${{ github.ref_name }} | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }} | |
file: .devcontainer/Dockerfile | |
provenance: false | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} | |
ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}-${{ github.ref_name }} | |
target: prod | |
strategy: | |
matrix: | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
package-publish: | |
needs: release-publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pdm-project/setup-pdm@v4 | |
with: | |
cache: true | |
python-version: '3.12' | |
- run: env | sort | |
- env: | |
PDM_PUBLISH_PASSWORD: ${{ secrets.PDM_PUBLISH_PASSWORD }} | |
PDM_PUBLISH_USERNAME: ${{ vars.PDM_PUBLISH_USERNAME != '' && vars.PDM_PUBLISH_USERNAME || '__token__' }} | |
run: make publish | |
pages: | |
needs: release-publish | |
permissions: | |
id-token: write | |
pages: write | |
runs-on: ubuntu-latest | |
steps: | |
- id: deployment | |
name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 | |
on: | |
push: | |
tags: | |
- v?[0-9]+.[0-9]+.[0-9]+ | |
- v?[0-9]+.[0-9]+.[0-9]+-?a[0-9]* | |
- v?[0-9]+.[0-9]+.[0-9]+-?b[0-9]* | |
- v?[0-9]+.[0-9]+.[0-9]+-?rc[0-9]* |