v1.0.0 #6
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-main | |
on: | |
release: | |
types: [created] | |
branches: [main, master] | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set up the environment | |
uses: ./.github/actions/setup-env | |
- name: Export tag | |
id: vars | |
run: echo tag=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT | |
- name: Build and publish | |
run: | | |
source .venv/bin/activate | |
poetry version $RELEASE_VERSION | |
make build-and-publish | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: docker.io | |
username: ${{ vars.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker images | |
env: | |
DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} | |
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }} | |
IMAGE_NAME: modpoll | |
TAG: ${{ steps.vars.outputs.tag }} | |
run: | | |
TAG=${TAG#v} | |
IFS='.' read -r MAJOR MINOR PATCH <<< "$TAG" | |
docker buildx build --platform linux/amd64,linux/arm64 -t ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/$IMAGE_NAME:$TAG --push . | |
docker buildx build --platform linux/amd64,linux/arm64 -t ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/$IMAGE_NAME:${MAJOR} --push . | |
docker buildx build --platform linux/amd64,linux/arm64 -t ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/$IMAGE_NAME:${MAJOR}.${MINOR} --push . | |
deploy-docs: | |
needs: build-and-publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set up the environment | |
uses: ./.github/actions/setup-env | |
- name: Build documentation | |
run: make docs | |
- name: Deploy documentation | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_build/html |