Skip to content

Commit fd85c1f

Browse files
committed
Update release.yml
1 parent a8a16c7 commit fd85c1f

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
types:
66
- created
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
release:
1013
runs-on: ubuntu-latest
@@ -18,23 +21,11 @@ jobs:
1821
run: php -d phar.readonly=0 bin/build -v"$RELEASE_VERSION"
1922

2023
- name: Upload phar
21-
run: |
22-
export PATH=${PATH}:`go env GOPATH`/bin
23-
export RELEASE_ID=$(curl --fail-with-body -L \
24-
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
25-
https://api.github.com/repos/deployphp/deployer/releases \
26-
| npx fx ".find(x=> x.tag_name == 'v${RELEASE_VERSION}').id")
27-
curl --fail-with-body -L \
28-
-X POST \
29-
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
30-
-H "Content-Type: application/octet-stream" \
31-
"https://uploads.github.com/repos/deployphp/deployer/releases/${RELEASE_ID}/assets?name=deployer.phar" \
32-
--data-binary "@deployer.phar"
24+
run: gh release upload ${{ github.event.release.tag_name }} deployer.phar
3325
env:
34-
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN_FOR_UPLOADING_RELEASES }}
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3527

3628
- name: Add deployer.phar
37-
shell: bash
3829
run: |
3930
set -x
4031
git checkout -b dist
@@ -43,25 +34,24 @@ jobs:
4334
git add -f dep
4435
4536
- name: Remove obsolete files & dirs
46-
shell: bash
4737
run: |
4838
set -x
4939
git rm -r .github/ bin/ docs/ tests/ *.lock *.yaml *.xml *.neon
5040
5141
- name: Update composer.json
52-
shell: bash
5342
run: |
5443
set -x
5544
cat composer.json | jq 'del(.autoload) | del(.scripts) | del(.require) | del(."require-dev") | setpath(["bin"]; "dep")' > composer-new.json
5645
mv composer-new.json composer.json
5746
git add composer.json
5847
5948
- name: Push release tag
60-
shell: bash
6149
run: |
6250
set -x
6351
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
6452
git config --global user.name "github-actions"
6553
git commit -m "Deployer $RELEASE_VERSION"
6654
git tag "v$RELEASE_VERSION" --force
6755
git push origin "v$RELEASE_VERSION" --force
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)