-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.98 KB
/
Copy pathrelease.yml
File metadata and controls
77 lines (67 loc) · 2.98 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
77
name: Release
on:
workflow_dispatch:
inputs:
environment:
description: "Environment"
required: true
default: "staging"
type: choice
options:
- staging
- production
version:
description: "Version number (production only)"
required: false
type: string
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ inputs.environment }}
steps:
- name: Clone repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Log in to image registry (Production)
if: ${{ inputs.environment == 'production' }}
run: |
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login registry.anvil.rcac.purdue.edu \
-u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
- name: Log in to chart project (Production)
if: ${{ inputs.environment == 'production' }}
run: |
mkdir -p "$RUNNER_TEMP/helm"
echo '${{ secrets.CHART_PROJECT_PASSWORD }}' | helm registry login registry.anvil.rcac.purdue.edu \
-u '${{ secrets.CHART_PROJECT_USERNAME }}' --password-stdin --registry-config "$RUNNER_TEMP/helm/registry-config.json"
- name: Log in to image registry (Staging)
if: ${{ inputs.environment == 'staging' }}
run: |
echo '${{ secrets.DOCKER_PASSWORD_STAGING }}' | docker login registry.anvil.rcac.purdue.edu \
-u '${{ secrets.DOCKER_USERNAME_STAGING }}' --password-stdin
- name: Log in to chart project (Staging)
if: ${{ inputs.environment == 'staging' }}
run: |
mkdir -p "$RUNNER_TEMP/helm"
echo '${{ secrets.CHART_PROJECT_PASSWORD_STAGING }}' | helm registry login registry.anvil.rcac.purdue.edu \
-u '${{ secrets.CHART_PROJECT_USERNAME_STAGING }}' --password-stdin --registry-config "$RUNNER_TEMP/helm/registry-config.json"
- name: Set up Git (Production)
if: ${{ inputs.environment == 'production' }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# This step is necessary because our script uses the destination OCI registry as a layer cache, which isn't supported by Docker out of the box.
# See https://docs.docker.com/build/cache/backends/registry/ and https://docs.docker.com/build/builders/drivers/ for more info.
- name: Set up buildx builder
run: |
docker buildx create --use
docker buildx inspect --bootstrap
- name: Release
run: ./.github/workflows/release/release-${{ inputs.environment }}.sh "${{ inputs.version }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEMPLATE_REG_CONFIG: ${{ runner.temp }}/helm/registry-config.json
- name: Log out of container registry
if: always()
run: docker logout registry.anvil.rcac.purdue.edu