Skip to content

Commit e7a8490

Browse files
Merge pull request #68 from easyscience/patch
Fixes the CI workflow
2 parents ba81eb7 + 9696929 commit e7a8490

File tree

3 files changed

+46
-34
lines changed

3 files changed

+46
-34
lines changed

.github/workflows/build-docs.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
push:
66
# Selected branches
77
branches: [develop, master, docs, patch]
8+
# Runs on creating a new tag starting with 'v', e.g. 'v1.0.3'
9+
tags:
10+
- 'v*'
811
# Allows you to run this workflow manually from the Actions tab
912
workflow_dispatch:
1013

@@ -160,10 +163,10 @@ jobs:
160163
path: site/
161164

162165
# Upload the static files from the site/ directory to be used in the next job
163-
# This extra step is needed to allow the download of the artifact in the next job
164-
# for pushing its content to the branch named 'gh_pages'
165-
- name: Upload built site as artifact for gh_pages (master branch)
166-
if: ${{ env.CI_BRANCH == 'master' }}
166+
# This artifact is only uploaded on tagged releases (tags starting with 'v', e.g., v1.0.3)
167+
# and is used to push content to gh_pages for custom domain deployment.
168+
- name: Upload built site as artifact for gh_pages (tagged release)
169+
if: startsWith(github.ref, 'refs/tags/v')
167170
uses: actions/upload-artifact@v4
168171
with:
169172
name: artifact # name of the artifact (without the extension zip)
@@ -206,26 +209,30 @@ jobs:
206209
(all branches)
207210
uses: actions/deploy-pages@v4
208211

209-
# Download built site as artifact from a previous job for gh_pages (master branch)
210-
- name: Download built site from previous job (master branch)
211-
if: ${{ env.CI_BRANCH == 'master' }}
212+
# Download built site as artifact from a previous job for gh_pages (tagged release)
213+
# This artifact is only downloaded on tagged releases (tags starting with 'v', e.g., v1.0.3)
214+
# and is used to push content to gh_pages for custom domain deployment.
215+
- name: Download built site from previous job (tagged release)
216+
if: startsWith(github.ref, 'refs/tags/v')
212217
uses: actions/download-artifact@v4
213218
with: # name or path are taken from the upload step of the previous job
214219
name: artifact
215220
path: site/ # directory to extract downloaded zipped artifacts
216221

217222
# Push the site files created in the previous job to the gh_pages branch
223+
# This push happens only for tagged releases (tags starting with 'v'),
224+
# which triggers deployment to the custom domain via webhook.
225+
#
218226
# To be able to push to the gh_pages branch, the personal GitHub API access
219227
# token GH_API_PERSONAL_ACCSESS_TOKEN must be set for this repository via
220228
# https://github.com/easyscience/diffraction-lib/settings/secrets/actions
221-
# This branch is used to deploy the site to the custom domain.
222-
# Deploying is done with a webhook:
229+
# Then the gh_pages branch is used to deploy the site to the custom domain.
230+
# Deploying is done with a webhook added via:
223231
# https://github.com/easyscience/diffraction-lib/settings/hooks
224-
# This is done for the gh_pages branch when the site is tested with a step above
225232
- name:
226233
Deploy to gh_pages branch to trigger deployment to custom domain
227-
(master branch)
228-
if: ${{ env.CI_BRANCH == 'master' }}
234+
(tagged release)
235+
if: startsWith(github.ref, 'refs/tags/v')
229236
uses: s0/git-publish-subdir-action@develop
230237
env:
231238
GITHUB_TOKEN: ${{ secrets.GH_API_PERSONAL_ACCSESS_TOKEN }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Drafts your next Release notes as pull requests are merged into
2+
# default branch
3+
4+
name: Update release draft
5+
6+
on:
7+
# Runs on pushes targeting the default branch
8+
push:
9+
branches:
10+
- main
11+
- master
12+
13+
jobs:
14+
draft-release-notes:
15+
permissions:
16+
# write permission is required to create a github release
17+
contents: write
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Drafts the next Release notes
23+
uses: release-drafter/release-drafter@v6
24+
with:
25+
disable-autolabeler: true
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/update-release-draft.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)