Merge pull request #158 from gonzolino/go121 #144
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release-please: | |
name: Release Please | |
outputs: | |
release_created: ${{ steps.release-please.outputs.release_created }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: release-please | |
uses: google-github-actions/release-please-action@v4.1.0 | |
with: | |
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
release-type: go | |
package-name: tado-window-control | |
deploy: | |
if: ${{ needs.release-please.outputs.release_created }} | |
name: Deploy Cloud Function | |
needs: release-please | |
runs-on: ubuntu-latest | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: "google-github-actions/auth@v2" | |
with: | |
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.GCP_DEPLOY_SA_EMAIL }} | |
- uses: google-github-actions/deploy-cloud-functions@v2.1.0 | |
with: | |
name: tado-window-close | |
runtime: go121 | |
entry_point: CloseWindow | |
region: ${{ secrets.GCP_REGION }} | |
env_vars: GCP_PROJECT=${{ secrets.GCP_PROJECT_ID }},TADO_CLIENT_ID=${{ secrets.TADO_CLIENT_ID }},TADO_CLIENT_SECRET=${{ secrets.TADO_CLIENT_SECRET }} | |
service_account_email: ${{ secrets.GCP_SA_EMAIL }} | |
label: | |
if: ${{ needs.release-please.outputs.release_created }} | |
name: Label PR | |
needs: deploy | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get PR number | |
id: pr | |
run: | | |
echo "pr_number=$(gh pr list --state merged --label 'autorelease: tagged' --json number --jq '.[0].number')" >> $GITHUB_OUTPUT | |
- run: "gh pr edit ${{ steps.pr.outputs.pr_number }} --remove-label 'autorelease: tagged'" | |
- run: "gh pr edit ${{ steps.pr.outputs.pr_number }} --add-label 'autorelease: published'" |