forked from galaxyproject/training-material
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (100 loc) · 4.05 KB
/
monthly-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
name: "[Archive] Monthly Release"
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 4 1 * *'
workflow_dispatch:
jobs:
setup:
if: github.repository_owner == 'galaxyproject'
runs-on: ubuntu-latest
# This is only needed for the final step of gh release creation.
# That should be separated into a separate dependent job at some point.
permissions:
contents: write
steps:
- name: Release Name
id: release_name
run: |
echo "release_title=$(LC_ALL=C date '+%Y %B %d')" >> $GITHUB_ENV
echo "release_tag=$(LC_ALL=C date -I)" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
# Based on logic in deploy.yml
fetch-depth: 1200
fetch-tags: true
persist-credentials: false
# BEGIN Dependencies
- uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: 'x64'
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
- uses: actions/setup-node@v4
with:
node-version: '19'
- uses: actions/cache@v4
with:
path: |
vendor/bundle
~/.cache/pip
~/.npm
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}-node-
${{ runner.os }}-gems-
- name: Install dependencies
run: |
sudo apt-get install -y build-essential libxi-dev libglu1-mesa-dev libglew-dev pkg-config pandoc # for node, release notes
gem install bundler
pip install pyyaml
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
rm -f package.json package-lock.json yarn.lock
npm install markdown-yaml-metadata-parser lunr
bundle pristine ffi
# END Dependencies
- name: List Tags
run: |
git tag -l
- name: Build Site
run: |
gem install bundler
bundle config path vendor/bundle
sed -i s"|^baseurl: .*|baseurl: '/archive/${SOURCE_TAG}'|g" _config.yml
sed -i s"|^github_repository_branch: .*|github_repository_branch: '${SOURCE_TAG}'|g" _config.yml
sed -i s"|^title: .*|title: 'GTN Archive ${SOURCE_TAG}'|g" _config.yml
curl -L https://hexylena.github.io/toolshed-version-database/tool-meta.json > metadata/tool-meta.json
make rebuild-search-index ACTIVATE_ENV=pwd
cat metadata/swagger.yaml | ruby bin/yaml2json.rb > api/swagger.json
JEKYLL_ENV=production bundle exec jekyll build --strict_front_matter -d _site/training-material
env:
SOURCE_TAG: ${{ env.release_tag }}
GTN_FORK: ${{ github.repository_owner }}
- name: Configure AWS credentials from GTN account
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Deploy 🚀
run: |
pip install awscli
./bin/publish-archive
env:
SOURCE_TAG: ${{ env.release_tag }}
- name: Create Release
id: create_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ env.release_tag }}
RELEASE_TITLE: ${{ env.release_title }}
run: |
# Compile release notes
echo "Monthly release of the GTN materials is now [available on the archive](https://training.galaxyproject.org/archive/$RELEASE_TAG/)." > /tmp/last-month-on.md
echo >> /tmp/last-month-on.md
bundle exec ruby bin/last-month-on.rb | pandoc --wrap none -t markdown -f html >> /tmp/last-month-on.md
# Create the release
gh release create "$RELEASE_TAG" --title "Release $RELEASE_TITLE" --notes-file /tmp/last-month-on.md --target main --latest