Skip to content

Commit

Permalink
Update release-please.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
live627 authored Oct 18, 2021
1 parent 50c6d12 commit 5930ca8
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
- uses: GoogleCloudPlatform/release-please-action@v2
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple
release-type: php
package-name: ${{ env.MOD_NAME }}
- uses: actions/github-script@v3
id: vars
Expand All @@ -34,26 +33,44 @@ jobs:
if: ${{ steps.release.outputs.pr && !steps.release.outputs.release_created }}
- if: ${{ steps.release.outputs.pr && !steps.release.outputs.release_created }}
run: |
version=$(cat ./version.txt)
version=$(cat ./composer.json | jq -r '.version')
for f in src/*.php; do
sed -i "/@version/c \ * @version $version" "$f"
done
sed -i "/<version>/c \ <version>$version</version>" src/package-info.xml
sed -i -E "1s/[0-9]+\.[0-9]+\.[0-9]+/$version/" src/readme.txt
sed -i -E "1s/[0-9]+\.[0-9]+\.[0-9]+/$version/" src/install.txt
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git commit -am "build: Update versions in mod files"
git push
- uses: actions/checkout@v2
if: ${{ steps.release.outputs.release_created }}
- run: zip -r -j myfile.zip src/
- run: tar -czvf myfile.tgz LICENSE README.md -C src $(ls src)
if: ${{ steps.release.outputs.release_created }}
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release asset
uses: actions/github-script@v2
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./myfile.zip
asset_name: ${{ env.MOD_NAME }}_${{ steps.release.outputs.major }}-${{ steps.release.outputs.minor }}-${{ steps.release.outputs.patch }}.zip
asset_content_type: application/zip
script: |
const fs = require('fs');
const release = await github.repos.getReleaseByTag({
...context.repo,
tag: "${{ steps.release.outputs.tag_name }}",
});
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
url: "${{ steps.release.outputs.upload_url }}",
repo: context.repo.repo,
headers: {
"content-type": "application/gzip",
"content-length": fs.statSync("./myfile.tgz").size
},
name: "${{ env.MOD_NAME }}_${{ steps.release.outputs.major }}-${{ steps.release.outputs.minor }}-${{ steps.release.outputs.patch }}.tgz",
data: fs.readFileSync("./myfile.tgz")
});
await github.repos.updateRelease({
...context.repo,
release_id: release.data.id,
draft: false,
name: "${{ steps.release.outputs.tag_name }}",
});
if: ${{ steps.release.outputs.release_created }}

0 comments on commit 5930ca8

Please sign in to comment.