Add manual task trigger api #62
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: Build | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
env: | |
NODE_VERSION: 12.22.1 | |
PROJECT_ID: movierater-1492834745733 | |
permissions: | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install dependencies | |
run: yarn install | |
- name: Build application | |
run: yarn build | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update && \ | |
sudo apt-get -y install docker-compose | |
- name: Start services | |
run: docker-compose up -d | |
- name: Wait for services to start | |
run: sleep 5 | |
- name: Run tests | |
run: yarn test | |
- name: Stop services | |
run: docker-compose down | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build Docker image | |
run: | | |
docker build -t asia-east1-docker.pkg.dev/${{ env.PROJECT_ID }}/movierater/movierater . | |
- id: 'auth' | |
name: 'Authenticate to GCP' | |
uses: 'google-github-actions/[email protected]' | |
with: | |
create_credentials_file: 'true' | |
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.SERVICE_ACCOUNT }} | |
- id: 'gcloud' | |
name: 'gcloud login' | |
run: |- | |
gcloud auth login --brief --cred-file="${{ steps.auth.outputs.credentials_file_path }}" | |
gcloud config set project ${{ env.PROJECT_ID }} | |
gcloud services list | |
gcloud auth configure-docker asia-east1-docker.pkg.dev | |
# Disable because Google cloud charge for this | |
# - name: Push Docker image to Artifact Registry | |
# run: | | |
# docker push asia-east1-docker.pkg.dev/${{ env.PROJECT_ID }}/movierater/movierater |