Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# This action looks at the commit history since the last release, and uses | ||
# this to decide which submodules require an update: | ||
on: | ||
push: | ||
branches: | ||
- master | ||
name: release-please-submodule | ||
jobs: | ||
# This logic looks at commits that have occurred since GitHub's magic | ||
# latestRelease: | ||
# https://developer.github.com/v3/repos/releases/#get-the-latest-release | ||
# TODO: it would be better if we retrieved a list of all prior releases, | ||
# and found the oldest release within the SUB_MODULES array. We need this | ||
# logic for other libraries as well, and would like to pull this logic | ||
# into its own action. | ||
changeFinder: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
submodules: ${{ steps.interrogate.outputs.submodules }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: interrogate | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const {execSync} = require('child_process'); | ||
const SUB_MODULES = [ | ||
'bigtable', | ||
'bigquery', | ||
'datastore', | ||
'firestore', | ||
'logging', | ||
'pubsub', | ||
'pubsublite', | ||
'spanner', | ||
'storage', | ||
]; | ||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); | ||
const latestRelease = await github.repos.getLatestRelease({ | ||
owner, | ||
repo | ||
}); | ||
console.info(`latest release: ${latestRelease.data.tag_name}`); | ||
// pull all tags, so we can get diff between HEAD and last release: | ||
execSync('git pull --tags'); | ||
execSync(`git reset --hard ${latestRelease.data.tag_name}`); | ||
const status = execSync(`git diff --name-only origin/master`, { encoding: 'utf-8'}); | ||
console.info(status); | ||
const changes = status.split('\n'); | ||
const submodules = new Set(); | ||
for (const change of changes) { | ||
const library = change.split('/')[0]; | ||
console.info(`update to path ${library}`); | ||
if (SUB_MODULES.includes(library)) { | ||
submodules.add(library); | ||
} | ||
} | ||
console.log(`::set-output name=submodules::${JSON.stringify(Array.from(submodules))}`); | ||
release-pr: # Create the release PR based on commit history: | ||
runs-on: ubuntu-latest | ||
needs: changeFinder | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
package: ${{fromJson(needs.changeFinder.outputs.submodules)}} | ||
steps: | ||
- uses: GoogleCloudPlatform/release-please-action@v2 | ||
id: release-please | ||
with: | ||
path: ${{ matrix.package }} | ||
token: ${{ secrets.FORKING_TOKEN }} | ||
fork: true | ||
release-type: go | ||
package-name: ${{ matrix.package }} | ||
monorepo-tags: true | ||
command: release-pr | ||
- uses: actions/github-script@v3 | ||
id: label # Adds the "autorelease: pending" label. | ||
if: ${{steps.release-please.outputs.pr}} | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); | ||
const latestRelease = await github.issues.addLabels({ | ||
owner, | ||
repo, | ||
issue_number: ${{steps.release-please.outputs.pr}}, | ||
labels: ['autorelease: pending'] | ||
}); | ||
console.log(`Tagged ${{steps.release-please.outputs.pr}}`) | ||
release-please-release: # Actually create a release tag. | ||
runs-on: ubuntu-latest | ||
needs: changeFinder | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
package: ${{fromJson(needs.changeFinder.outputs.submodules)}} | ||
steps: | ||
- uses: GoogleCloudPlatform/release-please-action@v2 | ||
id: tag-release | ||
with: | ||
path: ${{ matrix.package }} | ||
changelog-path: CHANGES.md | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: go | ||
monorepo-tags: true | ||
package-name: ${{ matrix.package }} | ||
command: github-release | ||
# Add the "autorelease: published" and remove tagged, this allows | ||
# monitoring to be enabled that detects failed releases: | ||
- uses: actions/github-script@v3 | ||
id: untag-release | ||
if: ${{steps.tag-release.outputs.pr}} | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); | ||
await github.issues.addLabels({ | ||
owner, | ||
repo, | ||
issue_number: ${{steps.tag-release.outputs.pr}}, | ||
labels: ['autorelease: published'] | ||
}); | ||
github.issues.removeLabel({ | ||
owner, | ||
repo, | ||
issue_number: ${{steps.tag-release.outputs.pr}}, | ||
name: 'autorelease: tagged', | ||
}); | ||
console.log(`Tagged ${{steps.tag-release.outputs.pr}}`) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This workflow creates release PRs and tags the top level release for | ||
# the top level repository: | ||
on: | ||
push: | ||
branches: | ||
- master | ||
name: release-please | ||
jobs: | ||
release-please-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: release-pr # Open the release PR from a fork. | ||
uses: GoogleCloudPlatform/release-please-action@v2 | ||
with: | ||
# token: ${{ secrets.FORKING_TOKEN }} | ||
token: ${{ secrets.FORKING_TOKEN }} | ||
release-type: go | ||
fork: true | ||
package-name: google-cloud-go | ||
command: release-pr | ||
- uses: actions/github-script@v3 | ||
id: label # Add the magic "autorelease: pending" label. | ||
if: ${{ steps.release-pr.outputs.pr }} | ||
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}}`) | ||
release-please-release: # Actually tag the release. | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: GoogleCloudPlatform/release-please-action@v2 | ||
id: tag-release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: go | ||
package-name: google-cloud-go | ||
command: github-release | ||
changelog-path: CHANGES.md | ||
# Add the "autorelease: published" and remove tagged, this allows | ||
# monitoring to be enabled that detects failed releases: | ||
- uses: actions/github-script@v3 | ||
id: untag-release | ||
if: ${{steps.tag-release.outputs.pr}} | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); | ||
await github.issues.addLabels({ | ||
owner, | ||
repo, | ||
issue_number: ${{steps.tag-release.outputs.pr}}, | ||
labels: ['autorelease: published'] | ||
}); | ||
github.issues.removeLabel({ | ||
owner, | ||
repo, | ||
issue_number: ${{steps.tag-release.outputs.pr}}, | ||
name: 'autorelease: tagged', | ||
}); | ||
console.log(`Tagged ${{steps.tag-release.outputs.pr}}`) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.