Skip to content

Commit fc6e161

Browse files
committed
Update CICD 2
1 parent 1729d91 commit fc6e161

11 files changed

+207
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: u24_element_before_release
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- '**'
8+
tags-ignore:
9+
- '**'
10+
workflow_dispatch:
11+
12+
anchor-dev-build-call: &dev-build-call
13+
uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main
14+
15+
anchor-test-build-call: &test-build-call
16+
uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main
17+
18+
anchor-prod-build-call: &prod-build-call
19+
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_build.yaml@main
20+
21+
jobs:
22+
call_context_check:
23+
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main
24+
call_u24_elements_build_alpine:
25+
!!merge <<: *$STAGE-build-call
26+
with:
27+
py_ver: 3.9
28+
image: djbase
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: u24_element_release_call
2+
3+
on:
4+
workflow_run:
5+
workflows: ["u24_element_tag_to_release"]
6+
types:
7+
- completed
8+
9+
anchor-dev-release-call: &dev-release-call
10+
uses: yambottle/djsciops-cicd/.github/workflows/u24_element_release.yaml@main
11+
12+
anchor-test-release-call: &test-release-call
13+
uses: yambottle/djsciops-cicd/.github/workflows/u24_element_release.yaml@main
14+
15+
anchor-prod-release-call: &prod-release-call
16+
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_release.yaml@main
17+
18+
anchor-dev-release-if: &dev-release-if
19+
if: >-
20+
github.event.workflow_run.conclusion == 'success' &&
21+
github.repository_owner == 'yambottle' &&
22+
!contains(github.event.workflow_run.head_branch, 'test')
23+
24+
anchor-test-release-if: &test-release-if
25+
if: >-
26+
github.event.workflow_run.conclusion == 'success' &&
27+
github.repository_owner == 'yambottle' &&
28+
!contains(github.event.workflow_run.head_branch, 'test')
29+
30+
anchor-prod-release-if: &prod-release-if
31+
if: >-
32+
github.event.workflow_run.conclusion == 'success' &&
33+
github.repository_owner == 'datajoint' &&
34+
!contains(github.event.workflow_run.head_branch, 'test')
35+
36+
jobs:
37+
call_context_check:
38+
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main
39+
test_call_u24_elements_release_alpine:
40+
if: >-
41+
github.event.workflow_run.conclusion == 'success' &&
42+
( contains(github.event.workflow_run.head_branch, 'test') ||
43+
(github.event.workflow_run.event == 'pull_request'))
44+
!!merge <<: *$STAGE-release-call
45+
with:
46+
py_ver: 3.9
47+
twine_repo: testpypi
48+
secrets:
49+
TWINE_USERNAME: ${{secrets.TWINE_TEST_USERNAME}}
50+
TWINE_PASSWORD: ${{secrets.TWINE_TEST_PASSWORD}}
51+
52+
call_u24_elements_release_alpine:
53+
!!merge <<: *$STAGE-release-if
54+
!!merge <<: *$STAGE-release-call
55+
with:
56+
py_ver: 3.9
57+
secrets:
58+
TWINE_USERNAME: ${{secrets.TWINE_USERNAME}}
59+
TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: u24_element_tag_to_release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
- 'test*.*.*'
8+
9+
anchor-dev-build-call: &dev-build-call
10+
uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main
11+
12+
anchor-test-build-call: &test-build-call
13+
uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main
14+
15+
anchor-prod-build-call: &prod-build-call
16+
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_build.yaml@main
17+
18+
jobs:
19+
call_context_check:
20+
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main
21+
call_u24_elements_build_alpine:
22+
!!merge <<: *$STAGE-build-call
23+
with:
24+
py_ver: 3.9
25+
image: djbase
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# For Github Action that doesn't support anchor yet...
3+
# https://github.com/actions/runner/issues/1182
4+
# yq is not the version from pypi with the same name.
5+
6+
export STAGE=${1:-prod}
7+
# .yaml in .staging_workflows has to be named using a prefix, e.g., 'anchored_', this will be removed when normalizing
8+
PREFIX=${2:-anchored_}
9+
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
10+
11+
run_yq() {
12+
local src_file
13+
local filename
14+
local target
15+
for src_file in "${SCRIPT_DIR}"/*.y*ml; do
16+
[[ ! -f ${src_file} ]] && continue
17+
filename=$(basename "$src_file")
18+
target="${SCRIPT_DIR}"/../workflows/${filename#"$PREFIX"}
19+
envsubst '${STAGE}' <"$src_file" | yq e 'explode(.) | del(.anchor-*)' >"$target"
20+
done
21+
}
22+
23+
run_yq

.github/make-dev.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
bash ./.staging_workflows/normalize.sh dev

.github/make-prod.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
bash ./.staging_workflows/normalize.sh prod

.github/make-test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
bash ./.staging_workflows/normalize.sh test

.github/run-act.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
3+
bash $SCRIPT_DIR/.staging_workflows/normalize.sh dev
4+
cd ..
5+
act -P ubuntu-latest=drewyangdev/ubuntu:act-latest \
6+
--secret-file $SCRIPT_DIR/.test/.secrets \
7+
--artifact-server-path $SCRIPT_DIR/.test/artifacts/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: u24_element_before_release
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- '**'
7+
tags-ignore:
8+
- '**'
9+
workflow_dispatch:
10+
jobs:
11+
call_context_check:
12+
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main
13+
call_u24_elements_build_alpine:
14+
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_build.yaml@main
15+
with:
16+
py_ver: 3.9
17+
image: djbase
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: u24_element_release_call
2+
on:
3+
workflow_run:
4+
workflows: ["u24_element_tag_to_release"]
5+
types:
6+
- completed
7+
jobs:
8+
call_context_check:
9+
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main
10+
test_call_u24_elements_release_alpine:
11+
if: >-
12+
github.event.workflow_run.conclusion == 'success' && ( contains(github.event.workflow_run.head_branch, 'test') || (github.event.workflow_run.event == 'pull_request'))
13+
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_release.yaml@main
14+
with:
15+
py_ver: 3.9
16+
twine_repo: testpypi
17+
secrets:
18+
TWINE_USERNAME: ${{secrets.TWINE_TEST_USERNAME}}
19+
TWINE_PASSWORD: ${{secrets.TWINE_TEST_PASSWORD}}
20+
call_u24_elements_release_alpine:
21+
if: >-
22+
github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'datajoint' && !contains(github.event.workflow_run.head_branch, 'test')
23+
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_release.yaml@main
24+
with:
25+
py_ver: 3.9
26+
secrets:
27+
TWINE_USERNAME: ${{secrets.TWINE_USERNAME}}
28+
TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}}

0 commit comments

Comments
 (0)