Comments (1)
Hi @martinandersen3d, you can achieve this by specifying the trigger type and branch. There are a few ways to do this. But the main idea is specifying which branch will trigger the workflow.
You could set up 2 different workflow files:
on:
push:
branches: [ main ]
jobs:
Deploy_Google_App_Engine:
name: Deploy To Google App Engine
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/deploy-appengine@main
with:
credentials: ${{ secrets.GOOGLE_CLOUD_PLATFORM_CREDENTIALS }}
version: server1_prod
# Or you could specify project_id if deploying to a different GCP project or deliverable and specify a different app.yaml ie app.prod.yaml
on:
push:
branches: [ staging ]
jobs:
Deploy_Google_App_Engine:
name: Deploy To Google App Engine
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/deploy-appengine@main
with:
credentials: ${{ secrets.GOOGLE_CLOUD_PLATFORM_CREDENTIALS }}
version: server2_beta
Or you could set up one workflow file and for every push to the branch (or merged PR into the branch) 'main' and 'staging' would start this workflow:
on:
push:
# Sequence of patterns matched against refs/heads
branches:
# Push events on main branch
- main
# Push events to branches matching refs/heads/staging
- staging
However, you would need expressions to specify where you are deploying.
jobs:
prod:
name: Deploy To Google App Engine
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo "Deploying to production server on branch $GITHUB_REF"
- uses: google-github-actions/deploy-appengine@main
with:
credentials: ${{ secrets.GOOGLE_CLOUD_PLATFORM_CREDENTIALS }}
version: server1_prod
# Or you could specify project_id if deploying to a different GCP project or deliverable and specify a different app.yaml ie app.prod.yaml
staging:
name: Deploy To Google App Engine
if: ${{ github.ref == 'refs/heads/staging' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo "Deploying to staging server on branch $GITHUB_REF"
- uses: google-github-actions/deploy-appengine@main
with:
credentials: ${{ secrets.GOOGLE_CLOUD_PLATFORM_CREDENTIALS }}
version: server2_beta
There are other ways to use conditionals if you don't want to specify the job twice.
from deploy-appengine.
Related Issues (20)
- Version 1.2 throws with "could not find 'app.yml' file" HOT 10
- v1.2.1 breaks when environment variable contains `=` HOT 1
- app.yaml in main directory not found in version 1.2.2 HOT 2
- Unable to use env_vars HOT 2
- Automated release is not working
- gcloud app deploy failed HOT 1
- The component [app-engine-go] not being installed HOT 3
- Nodejs 18 + HOT 11
- add support for --no-cache flag HOT 1
- Not able to deploy the app to Google Cloud HOT 1
- Automatic artifact cleanup HOT 1
- Build in successful in the GCP build Logs for App Engine but GitHub Actions fails later with pnpm HOT 4
- Better logging of failures
- Deploy app engine flex just stops half way HOT 4
- Deploying only cron.yaml fails on output parsing HOT 4
- Documentation misses authorisation for Artifact Registry HOT 2
- `project_id` arg mapped to `--project` for deploy command HOT 1
- Deploy to app Engine : Authentication backend unknown error HOT 1
- env_vars input does not seem to take effect HOT 2
- Promote flag default doesn't agree with docs HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deploy-appengine.