-
Notifications
You must be signed in to change notification settings - Fork 6
184 lines (157 loc) · 6.93 KB
/
deploy-dev-release.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# name: Deploy Dev Release Artifacts
# on:
# push:
# branches:
# - develop
# workflow_dispatch:
# inputs:
# release-version:
# description: "Version number to use. If provided bump-rule will be ignored"
# required: false
# default: ""
# type: string
# defaults:
# run:
# shell: bash
# env:
# LANG: en_US.utf-8
# LC_ALL: en_US.utf-8
# PYTHON_VERSION: "3.10"
# jobs:
# deploy-dev-release:
# runs-on: ubuntu-22.04
# permissions:
# contents: write # To push a branch
# pull-requests: write # To create a PR from that branch
# steps:
# - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
# - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
# - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
# #----------------------------------------------
# # check-out repo and set-up python
# #----------------------------------------------
# - name: Checkout code
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# # ref: develop
# token: ${{ secrets.GITHUB_TOKEN }}
# - name: Set up Python ${{ env.PYTHON_VERSION }}
# id: setup-python
# uses: actions/setup-python@v4
# with:
# python-version: ${{ env.PYTHON_VERSION }}
# #----------------------------------------------
# # ----- install & configure poetry -----
# #----------------------------------------------
# - name: Install Poetry
# uses: snok/[email protected]
# with:
# virtualenvs-create: true
# virtualenvs-in-project: true
# installer-parallel: true
# # #----------------------------------------------
# # # load cached venv if cache exists
# # #----------------------------------------------
# # - name: Load cached venv
# # id: cached-poetry-dependencies
# # uses: actions/cache@v3
# # with:
# # path: .venv
# # key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
# # #----------------------------------------------
# # # install dependencies if cache does not exist
# # #----------------------------------------------
# # - name: Install dependencies
# # if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# # run: poetry install --no-interaction --no-root
# #----------------------------------------------
# # install your root project, if required
# #----------------------------------------------
# - name: Install library
# run: |
# ./scripts/poetry_install.sh
# # git checkout develop
# # poetry lock --no-update
# # poetry install --no-interaction
# # - name: Use given release-version number
# # if: inputs.release-version != ''
# # run: |
# # echo "Using given release version is ${{ inputs.release-version }}"
# # poetry version ${{ inputs.release-version }}
# # NEW_TAG=v$(poetry version --short)
# # # we want to be able to use the variable in later
# # # steps we set a NEW_TAG environmental variable
# # echo "NEW_TAG=$(echo ${NEW_TAG})" >> $GITHUB_ENV
# # # we don't want to update pyproject.toml yet. don't want this change to create merge conflict.
# # # we don't really persist right version in pyproject.toml to figure out the next version. we use git tags.
# # git restore pyproject.toml
# #----------------------------------------------
# # bump version number for patch
# #----------------------------------------------
# - name: Bump Version
# run: |
# # current_tag is the last tagged release in the repository. From there
# # we need to remove the v from the beginning of the tag.
# # echo "Bump rule is ${{ inputs.bump-rule }}"
# # echo "Given release version is ${{ inputs.release-version }}"
# dt=$(date +%Y.%-m.0)
# if ! $(git tag -l "v*" = ''); then
# # uses -V which is version sort to keep it monotonically increasing.
# current_tag=$(git tag -l "v*" | grep --invert-match '-' | sort --reverse -V | sed -n 1p)
# echo "current git tag is ${current_tag}"
# current_tag=${current_tag#?}
# if [[ "$current_tag" < "$dt" ]]; then
# current_tag=$dt
# fi
# # current_tag is now the version we want to set our poetry version so
# # that we can bump the version
# ./scripts/run_on_each.sh poetry version ${current_tag}
# ./scripts/run_on_each.sh poetry version prerelease
# # poetry version ${current_tag}
# # poetry version prerelease --no-interaction
# else
# # very first release. start with inputs.release-version
# echo "First release. Setting tag as 0.1.0rc0"
# current_tag=$(date +%Y.%-m.1)
# ./scripts/run_on_each.sh poetry version ${current_tag}
# # poetry version ${current_tag}
# fi
# NEW_TAG=v$(poetry version --short)
# # Finally because we want to be able to use the variable in later
# # steps we set a NEW_TAG environmental variable
# echo "NEW_TAG=$(echo ${NEW_TAG})" >> $GITHUB_ENV
# - name: Create build artifacts
# run: |
# set -x
# set -u
# set -e
# # set the right version in pyproject.toml before build and publish
# ./scripts/poetry_build.sh
# - name: Push artifacts to github
# uses: ncipollo/release-action@v1
# with:
# artifacts: "dist/*.gz,dist/*.whl"
# artifactErrorsFailBuild: true
# generateReleaseNotes: true
# commit: ${{ github.ref }}
# # check bump-rule and set accordingly
# prerelease: true
# tag: ${{ env.NEW_TAG }}
# token: ${{ secrets.GITHUB_TOKEN }}
# - name: Publish to pypi
# id: publish-to-pypi
# if: github.repository_owner == 'GRIDAPPSD' || github.repository_owner == 'PNNL-CIM-Tools'
# run: |
# set -x
# set -u
# set -e
# # This is needed, because the poetry publish will fail at the top level of the project
# # so ./scripts/run_on_each.sh fails for that.
# echo "POETRY_PUBLISH_OPTIONS=''" >> $GITHUB_ENV
# cd gridappsd-python-lib
# poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
# poetry publish
# cd ../gridappsd-field-bus-lib
# poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
# poetry publish