-
Notifications
You must be signed in to change notification settings - Fork 14
87 lines (76 loc) · 2.85 KB
/
deploy.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
---
name: Deploy workflow
on:
workflow_dispatch:
inputs:
comments:
description: "Comments"
branch:
description: The branch from which to make the release
required: true
default: master
jobs:
release_changelog:
runs-on: ubuntu-latest
steps:
- name: Print author
run: |
echo "Author: ${{ github.triggering_actor }}"
echo "Comments: ${{ github.event.inputs.comments }}"
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Draft change log
uses: release-drafter/release-drafter@v5
id: release-drafter
with:
commitish: ${{ github.event.inputs.branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Can replace the below with (until pipeline description) with
# khanlab/actions/.github/workflows/workflow-version_task-publishGithub.yml
# after adding PAT token
- name: Set new release version
env:
RD_RELEASE: ${{ steps.release-drafter.outputs.name }}
run: |
if [ ! -z "$RD_RELEASE" ]; then
echo "NEW_RELEASE=$RD_RELEASE" >> $GITHUB_ENV
else
echo "NEW_RELEASE=0.1.0" >> $GITHUB_ENV
fi
- name: Update version in pyproject.toml
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "pyproject.toml"
find: 'version = "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))"'
replace: 'version = "${{ env.NEW_RELEASE }}"'
- name: Update version in pipeline_description (not actually used)
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "hippunfold/pipeline_description.json"
find: '"Version": "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))"'
replace: '"Version": "${{ env.NEW_RELEASE }}"'
- name: Update version in config/snakebids.yml
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "hippunfold/config/snakebids.yml"
find: 'version: "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))"'
replace: 'version: "${{ env.NEW_RELEASE }}"'
- name: Commit updates
env:
LATEST_VERSION: ${{ env.NEW_RELEASE }}
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git diff-index --quiet HEAD || git commit -m "Bump version to $LATEST_VERSION" -a
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish change log
uses: release-drafter/release-drafter@v5
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}