-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 2.2 KB
/
create-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Create a phar release
on:
schedule:
- cron: "16 */2 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
create:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Fetch latest phar"
uses: dsaltares/fetch-gh-release-asset@master
id: fetch_phar
with:
repo: PHPCSStandards/PHP_CodeSniffer
regex: true
file: "phpcs\\.phar(\\.asc)?"
target: "./"
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Verify GPG signature"
run: |-
gpg --no-default-keyring --keyring trustedkeys.kbx --receive-keys 689DAD778FF08760E046228BA978220305CD5C32
gpgv phpcs.phar.asc phpcs.phar
- name: "Fetch phpcs.xsd"
run: wget --timestamping https://github.com/PHPCSStandards/PHP_CodeSniffer/raw/${{ steps.fetch_phar.outputs.version }}/phpcs.xsd
- name: "Update replaced versions in composer.json"
run: jq --tab '.replace["phpcsstandards/php_codesniffer","squizlabs/php_codesniffer"] |= "${{ steps.fetch_phar.outputs.version }}"' composer.json > composer.json.new && mv composer.json.new composer.json
- name: "Commit and push any modified files"
id: commit_push
run: |-
git config user.name "Automated release"
git config user.email "[email protected]"
git add -A
git commit -m "Release ${{ steps.fetch_phar.outputs.version }}" || exit 0
git push
echo "release=true" >> $GITHUB_OUTPUT
- name: "Smoke test"
if: success() && steps.commit_push.outputs.release
run: |-
composer update
./phpcs --version
./phpcbf --version
- name: "Create release ${{ steps.fetch_phar.outputs.version }}"
if: success() && steps.commit_push.outputs.release
uses: ncipollo/release-action@v1
with:
name: ${{ steps.fetch_phar.outputs.name }}
body: "Find the [release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/${{ steps.fetch_phar.outputs.version }}) for version ${{ steps.fetch_phar.outputs.version }} [here](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/${{ steps.fetch_phar.outputs.version }})."
tag: ${{ steps.fetch_phar.outputs.version }}