Daily auto release #568
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: Daily auto release | |
on: | |
schedule: | |
- cron: '0 12 * * *' | |
workflow_dispatch: | |
jobs: | |
check-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.create-release.outputs.id }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Fetch release info | |
run: curl -sL https://api.github.com/repos/pdm-project/pdm/releases/latest > release-info.json | |
- name: Check modified files | |
id: check-files | |
uses: tj-actions/verify-changed-files@v19 | |
with: | |
files: release-info.json | |
- name: Commit latest release version | |
if: steps.check-files.outputs.files_changed == 'true' | |
run: | | |
git config --global user.name 'Semyon Dubrovin' | |
git config --global user.email 'seven45@mail.ru' | |
git add release-info.json | |
git commit -m "fix: upgrade pdm version" | |
git push | |
- name: Read new version data | |
id: read-metadata | |
if: steps.check-files.outputs.files_changed == 'true' | |
run: | | |
echo "name=$(cat release-info.json | jq -r '.name')" >> $GITHUB_OUTPUT | |
echo "tag_name=$(cat release-info.json | jq -r '.tag_name')" >> $GITHUB_OUTPUT | |
echo "draft=$(cat release-info.json | jq -r '.draft')" >> $GITHUB_OUTPUT | |
echo "prerelease=$(cat release-info.json | jq -r '.prerelease')" >> $GITHUB_OUTPUT | |
- name: Tag release | |
id: create-release | |
if: steps.check-files.outputs.files_changed == 'true' | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ steps.read-metadata.outputs.name }} | |
tag_name: ${{ steps.read-metadata.outputs.tag_name }} | |
draft: ${{ steps.read-metadata.outputs.draft }} | |
prerelease: ${{ steps.read-metadata.outputs.prerelease }} | |
publish-image: | |
name: Publish new image if release created | |
needs: check-release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python_tag: [ | |
"3.7-alpine", | |
"3.7-buster", | |
"3.7-bullseye", | |
"3.7-bookworm", | |
"3.7-slim", | |
"3.7", | |
"3.8-alpine", | |
"3.8-buster", | |
"3.8-bullseye", | |
"3.8-bookworm", | |
"3.8-slim", | |
"3.8", | |
"3.9-alpine", | |
"3.9-buster", | |
"3.9-bullseye", | |
"3.9-bookworm", | |
"3.9-slim", | |
"3.9", | |
"3.10-alpine", | |
"3.10-buster", | |
"3.10-bullseye", | |
"3.10-bookworm", | |
"3.10-slim", | |
"3.10", | |
"3.11-alpine", | |
"3.11-buster", | |
"3.11-bullseye", | |
"3.11-bookworm", | |
"3.11-slim", | |
"3.11", | |
] | |
steps: | |
- name: Set up QEMU | |
if: needs.check-release.outputs.release_id | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
if: needs.check-release.outputs.release_id | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
if: needs.check-release.outputs.release_id | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push Docker image | |
if: needs.check-release.outputs.release_id | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64,linux/arm64/v8,linux/arm64,linux/x86_64 | |
build-args: PYTHON_VERSION=${{ matrix.python_tag }} | |
push: true | |
tags: seven45/pdm-ci:${{ matrix.python_tag }} |