-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (133 loc) · 4.58 KB
/
tag.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Tag
on:
push:
branches:
- stable
paths:
- '**.py'
- '!tests/**'
jobs:
Build-Recipe:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Installing make
run: |
sudo apt-get update
sudo apt-get -y install make
- name: Checkout CI/CD Toolkit
uses: actions/checkout@v2
with:
repository: breakthewall/cicd-toolkit
path: cicd-toolkit
persist-credentials: false
fetch-depth: 0
- name: Building recipe
run: |
cd cicd-toolkit
make -C makefiles -f conda.mk build-recipe
- name: Saving recipe
uses: actions/upload-artifact@v4
with:
name: recipe
path: cicd-toolkit/recipe/meta.yaml
Conda-Build:
needs: [Build-Recipe]
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu", "macos"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Checkout CI/CD Toolkit
uses: actions/checkout@v2
with:
repository: breakthewall/cicd-toolkit
path: cicd-toolkit
persist-credentials: false
fetch-depth: 0
- name: Loading recipe
uses: actions/download-artifact@v4
with:
name: recipe
path: cicd-toolkit/recipe
- name: Deploying miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
environment-file: cicd-toolkit/recipe/conda_build_env.yaml
activate-environment: test
- name: Building & Testing conda package
run: | # Because on specific channel (e.g. bioconda), run 'make' command instead of 'conda-build'
cd cicd-toolkit
make conda-build
Tag:
needs: [Conda-Build]
runs-on: ubuntu-latest
outputs: # Create variable usable from another job
new_tag: ${{ steps.tag_version.outputs.new_tag }}
steps:
## CREATE TAG/RELEASE
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: stable
tag_prefix:
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## UPDATE CHANGELOG
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Generate CHANGELOG
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gem install github_changelog_generator
AUTH=$(echo $GITHUB_REPOSITORY | sed -e 's/\// /g' | awk '{print "--user " $1 " --project " $2}')
echo $AUTH
github_changelog_generator $AUTH --no-unreleased
- name: Update _version.py
env:
TAG: ${{ steps.tag_version.outputs.new_tag }}
run: |
folder=`dirname $(find . -name _version.py)`
echo "__version__ = \"$TAG\"" > $folder/_version.py
- name: Commit files
run: |
git config --local user.email "$GITHUB_EMAIL"
git config --local user.name "$GITHUB_USERNAME"
git commit -m "doc(CHANGELOG): update" -a
env:
GITHUB_USERNAME: breakthewall
GITHUB_EMAIL: [email protected]
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Update master branch
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master