-
Notifications
You must be signed in to change notification settings - Fork 80
124 lines (103 loc) · 3.91 KB
/
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
name: Release Workflow
on:
repository_dispatch:
types: [release]
env:
RELEASE_TYPE: ${{ github.event.client_payload.release_type }}
WORKFLOW_VERSION: ${{ github.event.client_payload.workflow_version }}
PREFIX_FOR_TEST: ${{ github.event.client_payload.test_prefix }}
jobs:
bump-main:
runs-on: macos-latest
steps:
- name: Calculate Release Branch
run: |
MAJOR=$(cut -d'.' -f1 <<<'${{ env.WORKFLOW_VERSION }}')
MINOR=$(cut -d'.' -f2 <<<'${{ env.WORKFLOW_VERSION }}')
echo "::set-env name=RELEASE_BRANCH::${{ env.PREFIX_FOR_TEST }}release-v$MAJOR.$MINOR.x"
- name: Checkout
uses: actions/checkout@v2
- name: Checkout Main
uses: actions/checkout@v2
with:
ref: ${{ env.PREFIX_FOR_TEST }}main
path: main
- name: Setup Release Branch (major, minor)
if: env.RELEASE_TYPE == 'major' || env.RELEASE_TYPE == 'minor'
run: |
cp -R main release
cd release
git checkout -b ${{ env.RELEASE_BRANCH }}
- name: Setup Release Branch (patch)
if: env.RELEASE_TYPE == 'patch'
uses: actions/checkout@v2
with:
ref: ${{ env.RELEASE_BRANCH }}
path: release
- name: Push changes to main
env:
GIT_USERNAME: ${{ github.actor }}
GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
cd main
git add -A . && git commit -m "Releasing ${{ env.WORKFLOW_VERSION }}" && git push -f
- name: Push Release Branch
run: |
cd release
ls Workflow*.podspec | xargs sed -i '' -e "s/ s.version\( *=\).*/ s.version\1 '${{ env.WORKFLOW_VERSION }}'/"
git add -A .; git commit -m "Releasing ${{ env.WORKFLOW_VERSION }}"
git tag ${{ env.PREFIX_FOR_TEST }}v${{ env.WORKFLOW_VERSION }}
git push origin ${{ env.RELEASE_BRANCH }} ${{ env.PREFIX_FOR_TEST }}v${{ env.WORKFLOW_VERSION }}
# Publish Documentation
# Swift caches (keys must match those defined in swift.yml)
- name: Load gem cache
uses: actions/cache@v1
with:
path: release/.bundle
key: gems-${{ hashFiles('Gemfile.lock') }}
- name: Set up Swift environment
run: |
# Set global bundle path so it gets used by build_swift_docs.sh running in the nested repo as well.
cd release
bundle config --global path "$(pwd)/.bundle"
bundle check || bundle install
# Don't need to run pod gen, the website script does that itself.
brew install sourcedocs
sudo xcode-select -s /Applications/Xcode_11.4.app
# Docs dependencies
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.12.3'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# This environment variable step should be run after all 3rd-party actions to ensure nothing
# else accidentally overrides any of our special variables.
- name: 'If in test-mode: enable dry run'
if: env.PREFIX_FOR_TEST != ''
run: |
# When PREFIX_FOR_TEST is not empty, we shouldn't actually deploy, just do a dry run to make
# sure all the dependencies are set up correctly.
echo "::set-env name=DRY_RUN::true"
- name: Debug info
run: |
cd release
echo event_name=${{ github.event_name }}
echo GITHUB_REF=$GITHUB_REF
echo GITHUB_HEAD_REF=$GITHUB_HEAD_REF
echo DRY_RUN=$DRY_RUN
git remote -v
## Main steps
- name: Build and deploy website
env:
WORKFLOW_GOOGLE_ANALYTICS_KEY: ${{ secrets.WORKFLOW_GOOGLE_ANALYTICS_KEY }}
GIT_USERNAME: ${{ github.actor }}
GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
cd release
./deploy_website.sh ${{ env.PREFIX_FOR_TEST }}v${{ env.WORKFLOW_VERSION }}
- name: Create Github Release
run: |
echo "TODO: Create Github Release"