-
Notifications
You must be signed in to change notification settings - Fork 16
126 lines (112 loc) · 4.93 KB
/
cd.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
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
117
118
119
120
121
122
123
124
125
126
name: CD
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
api_version:
description: "API Version"
default: "latest"
type: string
required: False
cli_version:
description: "CLI Version"
default: "latest"
type: string
required: False
jobs:
publish-container-image:
uses: ./.github/workflows/publish_container.yml
with:
image_version: ${{ github.sha }}
set-component-versions:
needs: publish-container-image
runs-on: ubuntu-latest
outputs:
api_version: ${{ steps.api_version.outputs.VERSION }}
cli_version: ${{ steps.cli_version.outputs.VERSION }}
steps:
- id: api_version
name: dynamic input worker version
run: |
if [[ "${{ inputs.api_version }}" == "" ]]; then echo "VERSION=latest" >> $GITHUB_OUTPUT; else echo "VERSION=${{ inputs.api_version }}" >> $GITHUB_OUTPUT;fi
- id: cli_version
name: dynamic input cli version
run: |
if [[ "${{ inputs.cli_version }}" == "" ]]; then echo "VERSION=latest" >> $GITHUB_OUTPUT; else echo "VERSION=${{ inputs.cli_version }}" >> $GITHUB_OUTPUT;fi
functional-tests-local:
needs: set-component-versions
name: FT Deploy Local Services
uses: ./.github/workflows/functional-tests.yml
with:
api_version: ${{ needs.set-component-versions.outputs.api_version }}
cli_version: ${{ needs.set-component-versions.outputs.cli_version }}
functional-tests-local-redis:
needs: set-component-versions
name: FT Deploy Local Services with Redis as Broker
uses: ./.github/workflows/functional-tests.yml
with:
docker_compose: docker-compose-redis.yml
api_version: ${{ needs.set-component-versions.outputs.api_version }}
cli_version: ${{ needs.set-component-versions.outputs.cli_version }}
functional-tests-aws:
needs: set-component-versions
name: FT Deploy AWS Services
uses: ./.github/workflows/functional-tests.yml
with:
docker_compose: docker-compose-aws.yml
api_version: ${{ needs.set-component-versions.outputs.api_version }}
cli_version: ${{ needs.set-component-versions.outputs.cli_version }}
# functional-tests-mysql:
# needs: set-component-versions
# name: FT Deploy MySQL Server
# uses: ./.github/workflows/functional-tests.yml
# with:
# docker_compose: docker-compose-mysql.yml
# api_version: ${{ needs.set-component-versions.outputs.api_version }}
# cli_version: ${{ needs.set-component-versions.outputs.cli_version }}
prepare-rc:
runs-on: ubuntu-latest
needs: [functional-tests-local, functional-tests-local-redis, functional-tests-aws]
outputs:
release_id: ${{ steps.gh-release.outputs.id }}
steps:
- id: gh-release
name: Publish GitHub release candiate
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda
with:
draft: true
name: ${{ github.ref_name }}-rc
tag_name: ${{ github.ref }}
body: "Release waiting for review ${{ github.sha }}: [ghcr.io/repository-service-tuf/repository-service-tuf-worker:${{ github.sha }}](https://github.com/repository-service-tuf/repository-service-tuf-worker/pkgs/container/repository-service-tuf-worker)"
release:
runs-on: ubuntu-latest
needs: prepare-rc
environment: release
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Docker Image on GitHub Registry
run: |
docker pull ghcr.io/repository-service-tuf/repository-service-tuf-worker:${{ github.sha }}
docker tag ghcr.io/repository-service-tuf/repository-service-tuf-worker:${{ github.sha }} ghcr.io/repository-service-tuf/repository-service-tuf-worker:${{ github.ref_name }}
docker tag ghcr.io/repository-service-tuf/repository-service-tuf-worker:${{ github.sha }} ghcr.io/repository-service-tuf/repository-service-tuf-worker:latest
docker push ghcr.io/repository-service-tuf/repository-service-tuf-worker:${{ github.ref_name }}
docker push ghcr.io/repository-service-tuf/repository-service-tuf-worker:latest
- name: Publish GitHub Release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
draft: false,
release_id: '${{ needs.prepare-rc.outputs.release_id }}',
name: '${{ github.ref_name }}',
body: 'docker pull [ghcr.io/repository-service-tuf/repository-service-tuf-worker:${{ github.ref_name }}](https://github.com/repository-service-tuf/repository-service-tuf-worker/pkgs/container/repository-service-tuf-worker)'
})