Skip to content

Commit 781301e

Browse files
authored
Merge pull request #372 from citation-file-format/199-publish-action-branch
Publish action now uses gh-pages to avoid overwriting main
2 parents e6f128b + 49d90f8 commit 781301e

3 files changed

Lines changed: 36 additions & 8 deletions

File tree

.github/workflows/publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ jobs:
2121
run: npm clean-install
2222
- name: Run build
2323
run: npm run build
24-
- uses: stefanzweifel/git-auto-commit-action@v4
24+
- name: Deploy to gh-pages
25+
uses: peaceiris/actions-gh-pages@v3
2526
with:
26-
commit_message: Update github.io page
27-
branch: main
28-
file_pattern: docs/
29-
commit_user_name: cffinit
30-
push_options: '--force'
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
publish_dir: ./dist
29+
user_name: 'cffinit[bot]'
30+
user_email: 'cffinit[bot]@users.noreply.github.com'
31+
commit_message: ':robot: Update github.io page'

README.dev.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,33 @@ To run linting on commit, you can install a git commit hook with
8484
npx husky install
8585
```
8686

87+
## Publishing
88+
89+
This app is published using [GitHub pages](https://github.com/citation-file-format/cff-initializer-javascript/settings/pages) automatically by the [Publish workflow](.github/workflows/publish.yml).
90+
The way this works is:
91+
92+
- After a commit is pushed to `main`, the workflow runs.
93+
- The workflow builds the app (using the `npm run build` command) into the folder `./dist`.
94+
- The GitHub action `peaceiris/actions-gh-pages@v3` pushes the contents of `./dist` to the branch [gh-pages](https://github.com/citation-file-format/cff-initializer-javascript/tree/gh-pages).
95+
- The `gh-pages` content is served by GitHub into <https://citation-file-format.github.io/cff-initializer-javascript/#/>
96+
97+
For this to work, a few things have to be set up for first time use:
98+
99+
- A `gh-pages` has to exist before the action is run. You can create an orphan branch to have a clean history with the following commands:
100+
101+
```bash
102+
git checkout --orphan gh-pages
103+
git rm -rf .
104+
# git rm other files and folders if necessary
105+
touch index.html
106+
git add index.html
107+
git commit -m "gh-pages created"
108+
git push origin gh-pages
109+
```
110+
111+
- After `gh-pages` is created, select it as the source for deployment of [GitHub pages](https://github.com/citation-file-format/cff-initializer-javascript/settings/pages).
112+
- Enable write permissions for `secrets.GITHUB_TOKEN` on workflows (see, e.g. [this post](https://github.com/peaceiris/actions-gh-pages/issues/744#issuecomment-1119685318)). This is done on [Settings -> Actions -> General -> Workflow permissions](https://github.com/citation-file-format/cff-initializer-javascript/settings/actions).
113+
87114
## Making a release
88115

89116
This section describes how to make a release in 2 parts:
@@ -95,7 +122,7 @@ This section describes how to make a release in 2 parts:
95122

96123
1. Verify that the information in `CITATION.cff` is correct
97124
2. Generate an updated version of `.zenodo.json` if needed using `cffconvert`
98-
3. Make sure the version field in `package.json` is correct
125+
3. Make sure the version field in `package.json` is correct
99126
4. By running `npm run lint` make sure the linter does not complain
100127
5. Run the unit tests with `npm run test:unit:ci`
101128
6. Make sure that github.io page is up to date

quasar.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module.exports = configure(function () {
5555
vueRouterMode: 'hash', // available values: 'hash', 'history'
5656
publicPath: 'cff-initializer-javascript',
5757
// transpile: false,
58-
distDir: 'docs',
58+
distDir: 'dist',
5959

6060
// Add dependencies for transpiling with Babel (Array of string/regex)
6161
// (from node_modules, which are by default not transpiled).

0 commit comments

Comments
 (0)