-
Notifications
You must be signed in to change notification settings - Fork 2
101 lines (85 loc) · 2.86 KB
/
release-without-versioning.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
name: Release without versioning
on:
push:
branches:
- dev
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: write
discussions: read
packages: write
pull-requests: write
repository-projects: write
security-events: read
statuses: write
jobs:
release:
name: Release without versioning
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
if: ${{ github.event_name != 'workflow_dispatch' }}
outputs:
affectedPackages: ${{ steps.affected-packages.outputs.affectPackages }}
environment: ${{ steps.get-deploy-environment.outputs.ENVIRONMENT }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
run_install: false
- name: Install turbo
run: pnpm install --global turbo
- name: Get affected app names
id: affected-apps
run: |
PACKAGES=$(pnpm turbo run build --filter='...[origin/beta]' --dry=json | jq -c '.packages | map(select(. != "//"))')
echo "packages=$PACKAGES" >> $GITHUB_OUTPUT
echo "packages=$PACKAGES"
- name: Generate affected packages
id: affected-packages
run: |
PACKAGES='${{ steps.affected-apps.outputs.packages }}'
PACKAGES_OUTPUT=$(echo $PACKAGES | jq -c 'map_values({name:.,ref:"refs/heads/${{ github.ref_name }}",imageTag:"${{ github.ref_name }}-${{ github.sha }}"})')
echo "affectPackages=$PACKAGES_OUTPUT" >> $GITHUB_OUTPUT
echo "affectPackages=$PACKAGES_OUTPUT"
- name: Get deploy environment
id: get-deploy-environment
run: |
if [[ ${{ github.ref_name }} == "main" ]]; then
echo "Deploy environment is production"
echo "ENVIRONMENT=prod" >> $GITHUB_OUTPUT
elif [[ ${{ github.ref_name }} == "beta" ]]; then
echo "Deploy environment is beta"
echo "ENVIRONMENT=beta" >> $GITHUB_OUTPUT
elif [[ ${{ github.ref_name }} == "dev" ]]; then
echo "Deploy environment is dev"
echo "ENVIRONMENT=dev" >> $GITHUB_OUTPUT
fi
deploy-with-docker:
needs:
- release
uses: ./.github/workflows/deploy-docker.yaml
with:
packages: ${{ needs.release.outputs.affectedPackages }}
environment: ${{ needs.release.outputs.environment }}
container-registry: ghcr.io
image-prefix: thinc-org/cugetreg
gitops-repository: thinc-org/cugetreg-gitops
gitops-ref: master
update-mode: commit
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}