-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5780679
commit 1e32597
Showing
3 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Deploy the production cloud function if pushing to the `main` branch or the test cloud function if pushing to the | ||
# `test` branch. | ||
name: gcloud-deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- test | ||
|
||
jobs: | ||
get-prefix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
name_prefix: ${{ steps.prefix.outputs.name_prefix }} | ||
dataset_name_prefix: ${{ steps.prefix.outputs.dataset_name_prefix }} | ||
steps: | ||
- name: Get prefix (test- or nothing for production) | ||
id: prefix | ||
run: | | ||
echo ${{ github.ref }} | ||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then | ||
echo "name_prefix=" >> $GITHUB_OUTPUT | ||
echo "dataset_name_prefix=" >> $GITHUB_OUTPUT | ||
else | ||
echo "name_prefix=test-" >> $GITHUB_OUTPUT | ||
echo "dataset_name_prefix=test_" >> $GITHUB_OUTPUT | ||
fi | ||
deploy: | ||
permissions: | ||
contents: "read" | ||
id-token: "write" | ||
runs-on: ubuntu-latest | ||
needs: get-prefix | ||
steps: | ||
- id: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- id: auth | ||
uses: google-github-actions/auth@v0 | ||
with: | ||
workload_identity_provider: "projects/885434704038/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider" | ||
service_account: "[email protected]" | ||
|
||
- uses: google-github-actions/deploy-cloud-functions@v0 | ||
with: | ||
name: ${{ needs.get-prefix.outputs.name_prefix }}data-gateway-sessions | ||
source_dir: data_gateway_sessions | ||
entry_point: extract_and_add_new_measurement_sessions | ||
memory_mb: 1024 | ||
region: europe-west6 | ||
runtime: python39 | ||
service_account_email: [email protected] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Only trigger when a pull request into main branch is merged | ||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
# This job will only run if the PR has been merged (and not closed without merging). | ||
if: "github.event.pull_request.merged == true && !contains(github.event.pull_request.head.message, 'skipci')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install poetry | ||
run: pip install poetry | ||
|
||
- name: Get package version | ||
id: version | ||
run: echo "::set-output name=package_version::$(poetry version -s)" | ||
|
||
- name: Create release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, no need to create your own. | ||
with: | ||
tag_name: ${{ steps.version.outputs.package_version }} | ||
release_name: ${{ github.event.pull_request.title }} | ||
body: ${{ github.event.pull_request.body }} | ||
draft: false | ||
prerelease: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This workflow updates the pull request description with an auto-generated section containing the categorised commit | ||
# message headers of the commits since the last pull request merged into main. The auto generated section is enveloped | ||
# between two comments: "<!--- START AUTOGENERATED NOTES --->" and "<!--- END AUTOGENERATED NOTES --->". Anything | ||
# outside these in the description is left untouched. Auto-generated updates can be skipped for a commit if | ||
# "<!--- SKIP AUTOGENERATED NOTES --->" is added to the pull request description. | ||
|
||
name: update-pull-request | ||
|
||
# Only trigger for pull requests into main branch. | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
description: | ||
if: "!contains(github.event.pull_request.body, '<!--- SKIP AUTOGENERATED NOTES --->')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: octue/[email protected] | ||
id: pr-description | ||
with: | ||
pull_request_url: ${{ github.event.pull_request.url }} | ||
api_token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Update pull request body | ||
uses: riskledger/update-pr-description@v2 | ||
with: | ||
body: ${{ steps.pr-description.outputs.pull_request_description }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |