Skip to content

Commit

Permalink
Bump up actions used in GitHub Actions (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
raahii authored May 6, 2024
1 parent d8d1d3a commit 5c2112a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 38 deletions.
78 changes: 40 additions & 38 deletions .github/workflows/workflow.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: workflow
name: ci

on:
push:
Expand All @@ -12,48 +12,48 @@ jobs:
check-server:
name: check server
runs-on: ubuntu-latest
timeout-minutes: 10

env:
PACKAGE_BASE_PATH: "${{ github.workspace }}/pkg"

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version-file: ./pkg/go.mod
cache-dependency-path: ./pkg/go.sum
cache: true

- name: Test code
- name: Run unit tests
run: make ci-test

- name: Upload test log
uses: actions/upload-artifact@v3
if: always()
with:
name: test-log
path: /tmp/gotest.log
if-no-files-found: error

check-front:
name: check front
runs-on: ubuntu-latest
timeout-minutes: 10

defaults:
run:
working-directory: front

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v3
node-version: 21.7.0

- name: Build
run: npm ci && npm run build

- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: front-dist-${{ github.sha }}
path: ./front/dist
Expand All @@ -66,13 +66,13 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20

needs: [check-server, check-front]

permissions:
contents: read
id-token: write
pull-requests: write

needs:
- check-server
- check-front

env:
TF_VERSION: "1.4.6"

Expand All @@ -81,10 +81,12 @@ jobs:
working-directory: deploy

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

# Go
- uses: actions/setup-go@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ./pkg/go.mod
cache-dependency-path: ./pkg/go.sum
Expand All @@ -94,18 +96,21 @@ jobs:
working-directory: .

# GCP
- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
- uses: "google-github-actions/setup-gcloud@v0"
- name: Authenticate Google Cloud
uses: google-github-actions/auth@v2
id: auth
with:
project_id: haraiai
export_default_credentials: true
- run: "gcloud info"
workload_identity_provider: ${{ vars.GCLOUD_WORKFLOW_IDENTITY_PROVIDER }}
service_account: ${{ vars.GCLOUD_SERVICE_ACCOUNT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: ">= 363.0.0"
- run: gcloud info

# Terraform
- uses: hashicorp/setup-terraform@v2
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
Expand All @@ -117,7 +122,7 @@ jobs:
if: github.event_name == 'pull_request'
run: terraform plan -no-color -input=false
continue-on-error: true
- uses: actions/github-script@v6
- uses: actions/github-script@v7
if: github.event_name == 'pull_request'
env:
PLAN: "${{ steps.plan.outputs.stdout }}"
Expand Down Expand Up @@ -156,13 +161,10 @@ jobs:
timeout-minutes: 20

if: github.ref == 'refs/heads/main'

needs:
- check-server
- check-front
needs: [check-server, check-front]

steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: front-dist-${{ github.sha }}
path: ./dist
Expand Down
1 change: 1 addition & 0 deletions front/.node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21.7.0

0 comments on commit 5c2112a

Please sign in to comment.