This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 99
76 lines (65 loc) · 2.05 KB
/
sfpowerscripts-promote-docker.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: Promote Docker Image in ghcr
on:
workflow_call:
inputs:
job-environment:
type: string
required: true
repo:
type: string
required: false
image:
type: string
required: false
default: sfpowerscripts
new-tag:
type: string
required: true
secrets:
username:
required: true
token:
required: true
jobs:
build:
name: 'promote docker image'
environment: ${{ inputs.job-environment }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Get package version'
run: |
echo "PKG_VERSION=$(jq -r ".version" packages/sfpowerscripts-cli/package.json)" >> $GITHUB_ENV
RELEASE_NAME=$(jq -r ".release" packages/sfpowerscripts-cli/package.json)
RELEASE_NAME_AS_ARRAY=($RELEASE_NAME)
RELEASE_NAME=$(echo ${RELEASE_NAME_AS_ARRAY[0]} | cut -c1-3)${RELEASE_NAME_AS_ARRAY[1]}
echo "RELEASE_NAME=release-$RELEASE_NAME" >> $GITHUB_ENV
- name: 'Re expose secrets'
run: |
echo "DOCKER_TOKEN=${{ env.token }}" >> $GITHUB_ENV
echo "DOCKER_USERNAME=${{ env.username }}" >> $GITHUB_ENV
env:
token : ${{ secrets.token }}
username : ${{ secrets.username }}
- name: 'Tag Docker'
uses: ./.github/actions/tagDocker
with:
repo: ${{ inputs.repo }}
image: ${{ inputs.image }}
existing-tag: ${{ env.PKG_VERSION }}-${{ github.run_id }}
new-tag: ${{ inputs.new-tag }}
registry: ghcr.io
username: ${{ env.DOCKER_USERNAME }}
token: ${{ env.DOCKER_TOKEN }}
- name: 'Tag Docker With Release Info'
uses: ./.github/actions/tagDocker
with:
repo: ${{ inputs.repo }}
image: ${{ inputs.image }}
existing-tag: ${{ env.PKG_VERSION }}-${{ github.run_id }}
new-tag: release-${{ env.RELEASE_VERSION }}
registry: ghcr.io
username: ${{ env.DOCKER_USERNAME }}
token: ${{ env.DOCKER_TOKEN }}