Daily auto release #122
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 if found new pdm-version on original repo | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.create-release.outputs.id }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- 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@v14 | |
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: Create release | |
id: create-release | |
if: steps.check-files.outputs.files_changed == 'true' | |
uses: softprops/action-gh-release@v1 | |
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", | |
"3.7-slim", | |
"3.7-alpine", | |
"3.7-buster", | |
"3.8", | |
"3.8-slim", | |
"3.8-alpine", | |
"3.8-buster", | |
"3.9", | |
"3.9-slim", | |
"3.9-alpine", | |
"3.9-buster", | |
"3.10", | |
"3.10-slim", | |
"3.10-alpine", | |
"3.10-buster", | |
"3.11", | |
"3.11-slim", | |
"3.11-alpine", | |
"3.11-buster", | |
] | |
steps: | |
- name: Set up QEMU | |
if: needs.check-release.outputs.release_id | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
if: needs.check-release.outputs.release_id | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
if: needs.check-release.outputs.release_id | |
uses: docker/login-action@v2 | |
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@v4 | |
with: | |
build-args: PYTHON_VERSION=${{ matrix.python_tag }} | |
push: true | |
tags: seven45/pdm-ci:${{ matrix.python_tag }} |