-
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.
Update GitHub Actions workflow and Docker registries
The code updates the GitHub Actions workflow by including an additional branch for 'snapshot' and updating the Docker meta and build-push actions to newer versions. The Docker container registry has been shifted from DigitalOcean to Google Artifacts Registry. This change requires a new login action and the removal of the 'Deploy-review' and 'Deploy-production' steps
- Loading branch information
1 parent
58192da
commit 4066c88
Showing
1 changed file
with
17 additions
and
43 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
branches: | ||
- 'dev' | ||
- 'snapshot' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
@@ -13,65 +14,38 @@ jobs: | |
tag: ${{ steps.meta.outputs.version }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: registry.digitalocean.com/governance/gol2 | ||
images: europe-west9-docker.pkg.dev/gol2-development/gol2/dev | ||
flavor: latest=false | ||
tags: | | ||
type=ref,suffix=-{{sha}},event=branch | ||
type=ref,suffix=-{{sha}},event=pr | ||
- name: Login to DO Container Registry | ||
uses: docker/login-action@v2 | ||
- uses: 'google-github-actions/auth@v2' | ||
id: auth | ||
with: | ||
registry: registry.digitalocean.com | ||
username: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | ||
password: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | ||
token_format: access_token | ||
project_id: 'governance-development' | ||
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | ||
|
||
- name: Login to GAR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: europe-west9-docker.pkg.dev | ||
username: oauth2accesstoken | ||
password: ${{ steps.auth.outputs.access_token }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
secrets: | | ||
"certificate=${{ secrets.CERTIFICATE }}" | ||
Deploy-review: | ||
if: github.event_name == 'workflow_dispatch' | ||
needs: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
tag: ${{ needs.Build.outputs.tag }} | ||
environment: | ||
name: review | ||
url: https://api-review.yuki-labs.dev | ||
steps: | ||
- name: DigitalOcean App Platform deployment | ||
uses: digitalocean/[email protected] | ||
with: | ||
app_name: gol2-review | ||
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | ||
images: '[{"name": "gol-2","image":{"registry_type": "DOCR","repository": "gol2","tag": "${{ env.tag }}"}}]' | ||
|
||
Deploy-production: | ||
if: github.event_name != 'workflow_dispatch' && github.ref == 'refs/heads/dev' | ||
needs: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
tag: ${{ needs.Build.outputs.tag }} | ||
environment: | ||
name: production | ||
url: https://gol2.io/ | ||
steps: | ||
- name: DigitalOcean App Platform deployment | ||
uses: digitalocean/[email protected] | ||
with: | ||
app_name: gol2 | ||
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | ||
images: '[{"name": "gol2","image":{"registry_type": "DOCR","repository": "gol2","tag": "${{ env.tag }}"}}]' |