Merge pull request #22 from itsubaki/dependabot/github_actions/google… #78
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: deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
concurrency: | |
group: deploy-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Add mask | |
run: | | |
echo "::add-mask::${{ secrets.PROJECT_ID }}" | |
echo "::add-mask::${{ secrets.SERVICE_URL }}" | |
- name: Auth Google Cloud | |
uses: "google-github-actions/auth@v2" | |
with: | |
credentials_json: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}" | |
- name: Setup Cloud SDK | |
uses: google-github-actions/[email protected] | |
with: | |
project_id: ${{ secrets.PROJECT_ID }} | |
- name: Integration Tests | |
env: | |
PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
run: | | |
make test | |
- name: Unit Tests | |
env: | |
PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
run: | | |
make testpkg | |
deploy: | |
needs: [test] | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Add mask | |
run: | | |
echo "::add-mask::${{ secrets.PROJECT_ID }}" | |
echo "::add-mask::${{ secrets.SERVICE_URL }}" | |
- name: Auth Google Cloud | |
uses: "google-github-actions/auth@v2" | |
with: | |
credentials_json: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}" | |
- name: Setup Cloud SDK | |
uses: google-github-actions/[email protected] | |
with: | |
project_id: ${{ secrets.PROJECT_ID }} | |
- name: Build image | |
env: | |
PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
run: | | |
make build | |
- name: Deploy to Google Cloud Run | |
env: | |
PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
run: | | |
make deploy |