Merge pull request #20 from guanguans/dependabot/github_actions/actio… #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release-please | |
on: | |
push: | |
branches: | |
- main | |
env: | |
ACTION_NAME: release-please-action | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
release-please-release: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- uses: GoogleCloudPlatform/release-please-action@main | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: node | |
package-name: ${{env.ACTION_NAME}} | |
command: github-release | |
- uses: actions/checkout@v4 | |
- name: tag major and patch versions | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN}}@github.com/google-github-actions/release-please-action.git" | |
git tag -d v${{ steps.release.outputs.major }} || true | |
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | |
git push origin :v${{ steps.release.outputs.major }} || true | |
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | |
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}" | |
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}" | |
git push origin v${{ steps.release.outputs.major }} | |
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} | |
if: ${{ steps.release.outputs.release_created }} | |
release-please-pr: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- release-please-release | |
steps: | |
- id: release-pr | |
uses: GoogleCloudPlatform/release-please-action@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: php | |
fork: true | |
package-name: ${{env.ACTION_NAME}} | |
command: release-pr | |
- id: label | |
if: ${{ steps.release-pr.outputs.pr }} | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); | |
await github.issues.addLabels({ | |
owner, | |
repo, | |
issue_number: ${{steps.release-pr.outputs.pr}}, | |
labels: ['autorelease: pending'] | |
}); | |
console.log(`Tagged ${{steps.release-pr.outputs.pr}}`) |