-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (71 loc) · 2.42 KB
/
deploy.yml
File metadata and controls
85 lines (71 loc) · 2.42 KB
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
name: deploy
on:
#schedule:
# * is a special character in YAML so you have to quote this string
# - cron: "0 0 * * 0"
repository_dispatch:
types: [pretext-publish]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Sets up python3
- uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Checkout
uses: actions/checkout@v4
- name: Discover latest CLI version
run: |
LATEST_VERSION=$(curl -s https://api.github.com/repos/PreTeXtBook/pretext-cli/releases/latest | jq -r .tag_name)
echo "CLI_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
- name: Get latest static version
run: |
git fetch --tags
git tag -l | sort -V | tail -n 1
echo "THIS_VERSION=$(git tag -l | sort -V | tail -n 1)" >> $GITHUB_ENV
- name: Fetch CLI repository
run: |
git clone https://github.com/pretextbook/pretext-cli.git
cd pretext-cli
#git checkout $CLI_VERSION
# Setup poetry
- name: Install poetry 1.8.4
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry==1.8.4
- name: Install CLI
run: |
cd pretext-cli
poetry install
poetry run python scripts/copy_cdn_files.py ../dist
- name: setup git config
run: |
# setup the username and email.
git config user.name "${{ github.actor }} via GitHub Actions"
git config user.email "${{ github.actor }}@github_actions.no_reply"
- name: Commit dist folder
run: |
git add dist
git commit -m "Update css and js for CDN" || echo "No new commit needed"
git push origin main || echo "All done"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create a new tag at current commit and push it
- name: Create tag
run: |
git tag -a $CLI_VERSION -m "Update css and js for CDN"
git push origin --tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.CLI_VERSION }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="$tag" \
--notes="CDN files updated to CLI version $tag"