Repository navigation
76 lines (72 loc) · 2.58 KB
/
Copy pathdeploy.yml
File metadata and controls
76 lines (72 loc) · 2.58 KB
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: BMO Deployment
on:
push:
branches:
- development
tags:
- release-**
env:
IMAGE_NAME: mozilla-bteam/bmo
GAR_LOCATION: us
GCP_PROJECT_ID: moz-fx-bugzilla-prod
GAR_REPOSITORY: bugzilla-prod
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Create directory for artifacts
run: mkdir build_info
- name: Build and then copy version.json and build push data
run: |
docker compose run --build --no-deps --name push_data bmo.test push_data
docker cp push_data:/app/push_data/blog.push.txt build_info/blog.push.txt
docker cp push_data:/app/push_data/markdown.push.txt build_info/markdown.push.txt
docker cp push_data:/app/push_data/bug.push.txt build_info/bug.push.txt
docker cp push_data:/app/push_data/email.push.txt build_info/email.push.txt
docker cp push_data:/app/push_data/tag.txt build_info/tag.txt
docker cp push_data:/app/push_data/wiki.push.txt build_info/wiki.push.txt
docker cp push_data:/app/version.json build_info/version.json
docker rm push_data
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: Build Info
path: build_info
deploy:
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
- id: gcp-auth
name: Google authentication
uses: google-github-actions/auth@v3
with:
token_format: "access_token"
service_account: artifact-writer@${{ env.GCP_PROJECT_ID }}.iam.gserviceaccount.com
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_POOL_PROJECT_NUMBER }}
- name: Log in to the container registry
uses: docker/login-action@v4
with:
registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.gcp-auth.outputs.access_token }}
- name: Build and push image
uses: docker/build-push-action@v7
with:
context: .
target: base
tags: |
${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/bmo:${{ github.ref_name }}
build-args: |
GITHUB_SHA=${{ github.sha }}
GITHUB_SERVER_URL=${{ github.server_url }}
GITHUB_RUN_ID=${{ github.run_id }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max