This repository was archived by the owner on Mar 15, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (43 loc) · 1.65 KB
/
update-phar.yaml
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
name: "Update composer-unused.phar"
on:
repository_dispatch:
types: [update-plugin]
jobs:
myEvent:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: "Download latest phar"
run: "curl -OL https://github.com/composer-unused/composer-unused/releases/download/${{ github.event.client_payload.tag }}/composer-unused.phar"
- name: "Update require version in composer.json"
uses: sergeysova/jq-action@v2
id: version
with:
cmd: jq '.require."icanhazstring/composer-unused" = "^${{ github.event.client_payload.tag }}"' composer.json
multiline: true
- name: "Replace composer.json content"
run: echo -E "${{ steps.version.outputs.value }}" > composer.json
- name: "Commit new phar"
uses: "stefanzweifel/git-auto-commit-action@v4"
with:
commit_message: "Update composer-unused to version ${{ github.event.client_payload.tag }}"
file_pattern: "*.*"
- name: "Create release"
uses: "actions/github-script@v6"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
try {
await github.rest.repos.createRelease({
draft: false,
generate_release_notes: true,
name: "${{ github.event.client_payload.tag }}",
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: "${{ github.event.client_payload.tag }}"
});
} catch (error) {
core.setFailed(error.message);
}