-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (72 loc) · 2.2 KB
/
test_and_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: test-and-build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
# workaround
# create emulator image because service container does not support docker command arguments
prepare_emulator_image:
name: Prepare emulator image
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
strategy:
matrix:
target: [firestore-emulator]
env:
GCLOUD_VERSION: "406.0.0"
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup docker buildx
uses: docker/[email protected]
- name: Build and push docker image
uses: docker/[email protected]
with:
context: .
file: docker/${{ matrix.target }}/Dockerfile
platforms: ${{ steps.params.outputs.platforms }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
push: true
build-args: |
BASE_IMAGE_TAG=${{ env.GCLOUD_VERSION }}-emulators
tags: |
ghcr.io/${{ github.repository_owner }}/${{ matrix.target }}:latest
test:
needs: [prepare_emulator_image]
permissions:
contents: read
packages: read
checks: write
uses: ww24/linebot/.github/workflows/test.yaml@73705893378fa4d1f1bfa0bc76e55de0e7ad9283
docker:
needs: [test]
permissions:
contents: read
packages: write
id-token: write
security-events: write
uses: ww24/linebot/.github/workflows/docker.yml@73705893378fa4d1f1bfa0bc76e55de0e7ad9283
with:
image_tag: latest
push: ${{ github.event_name == 'push' }}
secrets:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_PROJECT_NUMBER: ${{ secrets.GCP_PROJECT_NUMBER }}