-
Notifications
You must be signed in to change notification settings - Fork 191
116 lines (109 loc) · 3.27 KB
/
workflow.yaml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Workflow for install-docker
on:
push:
branches:
- master
pull_request:
branches:
- master
create:
tags:
- '*'
jobs:
validate:
permissions:
contents: read
runs-on: ubuntu-latest
container:
image: rancher/dapper:v0.6.0
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate
run: dapper validate
test:
permissions:
contents: read
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
container:
image: rancher/dapper:v0.6.0
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Test
run: dapper test
add-commit-to-version-file:
permissions:
contents: read
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Add commit to version file
run: |
echo "{\"version\": \"${{ github.sha }}\"}" > dist/VERSION"
upload-dev:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Retrieve Google auth from vault
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/google-auth/rancher/credentials | GOOGLE_AUTH
- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ env.GOOGLE_AUTH }}'
- name: Upload to Google Cloud Storage
uses: google-github-actions/upload-cloud-storage@v2
with:
path: dist/
destination: releases.rancher.com/install-docker-dev
predefinedAcl: publicRead
headers: |-
Cache-Control: public,no-cache,proxy-revalidate
add-tag-to-version-file:
permissions:
contents: read
runs-on: ubuntu-latest
if: github.event_name == 'create' && github.ref_type == 'tag'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Add tag to version file
run: |
echo "{\"version\": \"${{ github.ref_name }}\"}" > dist/VERSION"
upload:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'create' && github.ref_type == 'tag'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Retrieve Google auth from vault
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/google-auth/rancher/credentials | GOOGLE_AUTH
- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GOOGLE_AUTH }}'
- name: Upload to Google Cloud Storage
uses: google-github-actions/upload-cloud-storage@v2
with:
path: dist/
destination: releases.rancher.com/install-docker
predefinedAcl: publicRead
headers: |-
Cache-Control: public,no-cache,proxy-revalidate