Minor change

pull/977/head
Michele Locati 2024-09-09 17:39:17 +02:00
parent d4a1c15926
commit 96eb62e1d3
No known key found for this signature in database
GPG Key ID: 98B7CE2E7234E28B
1 changed files with 28 additions and 14 deletions

View File

@ -18,7 +18,8 @@ jobs:
env: env:
VERSIONTAG_THIS: "" VERSIONTAG_THIS: ""
steps: steps:
- name: Checkout -
name: Checkout
if: > if: >
(github.event_name == 'push' && github.ref == 'refs/heads/master') (github.event_name == 'push' && github.ref == 'refs/heads/master')
|| (github.event_name == 'create' && github.event.ref_type == 'tag') || (github.event_name == 'create' && github.event.ref_type == 'tag')
@ -27,7 +28,8 @@ jobs:
with: with:
ref: master ref: master
fetch-depth: 0 fetch-depth: 0
- name: Update README -
name: Update README
if: > if: >
(github.event_name == 'push' && github.ref == 'refs/heads/master') (github.event_name == 'push' && github.ref == 'refs/heads/master')
|| github.event_name == 'repository_dispatch' || github.event_name == 'repository_dispatch'
@ -43,7 +45,8 @@ jobs:
git commit -m '[skip ci] Automatically update README.md' git commit -m '[skip ci] Automatically update README.md'
git push git push
fi fi
- name: Look for the recent version tags -
name: Look for the recent version tags
if: > if: >
(github.event_name == 'push' && github.ref == 'refs/heads/master') (github.event_name == 'push' && github.ref == 'refs/heads/master')
|| (github.event_name == 'create' && github.event.ref_type == 'tag') || (github.event_name == 'create' && github.event.ref_type == 'tag')
@ -69,7 +72,8 @@ jobs:
fi fi
printf 'VERSIONTAG_LAST=%s\n' "$VERSIONTAG_LAST" >> "$GITHUB_ENV" printf 'VERSIONTAG_LAST=%s\n' "$VERSIONTAG_LAST" >> "$GITHUB_ENV"
printf 'VERSIONTAG_PENULTIMATE=%s\n' "$VERSIONTAG_PENULTIMATE" >> "$GITHUB_ENV" printf 'VERSIONTAG_PENULTIMATE=%s\n' "$VERSIONTAG_PENULTIMATE" >> "$GITHUB_ENV"
- name: Check if we need to create a version tag after a push -
name: Check if we need to create a version tag after a push
if: github.event_name == 'push' && github.ref == 'refs/heads/master' if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: | run: |
VERSIONTAG_THIS= VERSIONTAG_THIS=
@ -96,17 +100,20 @@ jobs:
fi fi
printf 'VERSIONTAG_THIS=%s\n' "$VERSIONTAG_THIS" >> "$GITHUB_ENV" printf 'VERSIONTAG_THIS=%s\n' "$VERSIONTAG_THIS" >> "$GITHUB_ENV"
printf 'VERSIONTAG_PREVIOUS=%s\n' "$VERSIONTAG_LAST" >> "$GITHUB_ENV" printf 'VERSIONTAG_PREVIOUS=%s\n' "$VERSIONTAG_LAST" >> "$GITHUB_ENV"
- name: Sleep for a while before creating a tag -
name: Sleep for a while before creating a tag
if: env.VERSIONTAG_THIS != '' if: env.VERSIONTAG_THIS != ''
uses: juliangruber/sleep-action@v1 uses: juliangruber/sleep-action@v1
with: with:
time: 30s time: 30s
- name: Create version tag after a push in the local repository -
name: Create version tag after a push in the local repository
if: env.VERSIONTAG_THIS != '' if: env.VERSIONTAG_THIS != ''
run: | run: |
git tag -- "$VERSIONTAG_THIS" git tag -- "$VERSIONTAG_THIS"
printf 'VERSIONTAG_THIS_SHA=%s\n' "$(git rev-parse HEAD)" >> "$GITHUB_ENV" printf 'VERSIONTAG_THIS_SHA=%s\n' "$(git rev-parse HEAD)" >> "$GITHUB_ENV"
- name: Create version tag after a push in the remote repository -
name: Create version tag after a push in the remote repository
if: env.VERSIONTAG_THIS != '' if: env.VERSIONTAG_THIS != ''
uses: actions/github-script@v3 uses: actions/github-script@v3
with: with:
@ -118,7 +125,8 @@ jobs:
ref: `refs/tags/${process.env.VERSIONTAG_THIS}`, ref: `refs/tags/${process.env.VERSIONTAG_THIS}`,
sha: process.env.VERSIONTAG_THIS_SHA sha: process.env.VERSIONTAG_THIS_SHA
}) })
- name: Check format of received tag -
name: Check format of received tag
if: github.event_name == 'create' && github.event.ref_type == 'tag' if: github.event_name == 'create' && github.event.ref_type == 'tag'
run: | run: |
VERSIONTAG_THIS="${GITHUB_REF#refs/tags/}" VERSIONTAG_THIS="${GITHUB_REF#refs/tags/}"
@ -135,7 +143,8 @@ jobs:
fi fi
printf 'VERSIONTAG_THIS=%s\n' "$VERSIONTAG_THIS" >> "$GITHUB_ENV" printf 'VERSIONTAG_THIS=%s\n' "$VERSIONTAG_THIS" >> "$GITHUB_ENV"
printf 'VERSIONTAG_PREVIOUS=%s\n' "$VERSIONTAG_PENULTIMATE" >> "$GITHUB_ENV" printf 'VERSIONTAG_PREVIOUS=%s\n' "$VERSIONTAG_PENULTIMATE" >> "$GITHUB_ENV"
- name: Extract release notes -
name: Extract release notes
if: env.VERSIONTAG_THIS != '' if: env.VERSIONTAG_THIS != ''
run: | run: |
printf 'Generating release notes for tag %s\n' "$VERSIONTAG_THIS" printf 'Generating release notes for tag %s\n' "$VERSIONTAG_THIS"
@ -149,16 +158,19 @@ jobs:
printf 'Release notes:\n%s\n' "$RELEASE_NOTES" printf 'Release notes:\n%s\n' "$RELEASE_NOTES"
printf 'RELEASE_NAME=v%s\n' "$VERSIONTAG_THIS" >> "$GITHUB_ENV" printf 'RELEASE_NAME=v%s\n' "$VERSIONTAG_THIS" >> "$GITHUB_ENV"
printf 'RELEASE_NOTES<<EOF\n%s\nEOF\n' "$RELEASE_NOTES" >> "$GITHUB_ENV" printf 'RELEASE_NOTES<<EOF\n%s\nEOF\n' "$RELEASE_NOTES" >> "$GITHUB_ENV"
- name: Set script version -
name: Set script version
if: env.VERSIONTAG_THIS != '' if: env.VERSIONTAG_THIS != ''
run: sed -i -E "s/^(IPE_VERSION=)master$/\1$VERSIONTAG_THIS/" install-php-extensions run: sed -i -E "s/^(IPE_VERSION=)master$/\1$VERSIONTAG_THIS/" install-php-extensions
- name: Login to Docker Hub -
name: Login to Docker Hub
if: env.VERSIONTAG_THIS != '' if: env.VERSIONTAG_THIS != ''
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: mlocati username: mlocati
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build docker image -
name: Build docker image
if: env.VERSIONTAG_THIS != '' if: env.VERSIONTAG_THIS != ''
run: > run: >
docker build docker build
@ -167,10 +179,12 @@ jobs:
--tag "mlocati/php-extension-installer:${VERSIONTAG_THIS%%.*}" --tag "mlocati/php-extension-installer:${VERSIONTAG_THIS%%.*}"
--tag mlocati/php-extension-installer:latest --tag mlocati/php-extension-installer:latest
. .
- name: Push docker image to Docker Hub -
name: Push docker image to Docker Hub
if: env.VERSIONTAG_THIS != '' if: env.VERSIONTAG_THIS != ''
run: docker push --all-tags mlocati/php-extension-installer run: docker push --all-tags mlocati/php-extension-installer
- name: Create release -
name: Create release
if: env.VERSIONTAG_THIS != '' if: env.VERSIONTAG_THIS != ''
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with: