Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflows for automated releases and github-pages builds #3137

Merged
merged 43 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
61e5f83
Working on github pages workflow
alexcottner Jan 22, 2024
88b21e1
removed on manual placeholder
alexcottner Jan 22, 2024
b8718eb
adding on workflow_dispatch
alexcottner Jan 22, 2024
096144c
fixing yaml
alexcottner Jan 22, 2024
cfaeff4
adjusting yaml again
alexcottner Jan 22, 2024
c8d87b0
removed cross-env reference
alexcottner Jan 22, 2024
95552af
copying git user name and email from last commit
alexcottner Jan 22, 2024
7723aa3
inspecting git username and email
alexcottner Jan 22, 2024
b267bf9
Switching to use github pages actions
alexcottner Jan 22, 2024
cb0a34c
fixing indent
alexcottner Jan 22, 2024
69267c6
trying to fix workflow...
alexcottner Jan 22, 2024
fe811b3
More tweaks
alexcottner Jan 22, 2024
3166143
Switching to upload-pages-artifact
alexcottner Jan 22, 2024
27943a2
changing path
alexcottner Jan 22, 2024
72fbc30
fixing asset path
alexcottner Jan 22, 2024
6a5594d
updated readme to include github-pages deployment notes
alexcottner Jan 22, 2024
ec0b55a
Merge branch 'Kinto:master' into master
alexcottner Jan 23, 2024
476ef39
Merge branch 'github-build'
alexcottner Jan 23, 2024
096b7eb
Working on release creation on tag
alexcottner Jan 23, 2024
53d6fa7
adding tags fetch before checking latest tag
alexcottner Jan 23, 2024
28e6474
Removing tag from gh-page version since we don't appear to have that …
alexcottner Jan 23, 2024
68db91e
updated readme for releasing
alexcottner Jan 23, 2024
ab6441f
Update README.md to be more clear on publishing to gh pages
alexcottner Jan 24, 2024
8e0ea56
updating readme with more release info
alexcottner Jan 24, 2024
4b62cdb
renamed gh-page to gh-pages
alexcottner Jan 24, 2024
f8505a4
simplifying sed
alexcottner Jan 24, 2024
9e016b9
Fleshed out deploying to github pages section in readme
alexcottner Jan 24, 2024
29586d3
Working on gh-pages updates
alexcottner Jan 25, 2024
7ff878e
switching to ref_name
alexcottner Jan 25, 2024
3581254
ref and ref_name are empty?
alexcottner Jan 25, 2024
137f8f2
fixed version number for pages release on tag
alexcottner Jan 25, 2024
f707899
fixing GITHUB_REF var
alexcottner Jan 25, 2024
343aa60
Changing version number string based on feedback
alexcottner Jan 25, 2024
e6b6c03
Making single-server build notes more detailed
alexcottner Jan 25, 2024
dd08c2b
simplifying version number setting
alexcottner Jan 25, 2024
0c6435c
need to add fetch-depth for all actions/checkouts
alexcottner Jan 25, 2024
1f8a086
Removing 3rd party action
alexcottner Jan 26, 2024
83f9e67
fixed var name
alexcottner Jan 26, 2024
b809d8f
Added gh token
alexcottner Jan 26, 2024
5345ee2
consuming error
alexcottner Jan 26, 2024
719c9e3
Removed gh-pages dependency
alexcottner Jan 26, 2024
4107f98
Merge branch 'Kinto:master' into master
alexcottner Jan 26, 2024
e3ffc89
fixing merge conflict
alexcottner Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
Expand All @@ -36,6 +39,9 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
Expand All @@ -59,6 +65,9 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy to GitHub Pages
on:
release:
types:
- published
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'npm'

- name: Install Node dependencies
run: npm ci

- name: Build the package
run: |
ASSET_PATH=/kinto-admin/ npm run build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/

deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
runs-on: ubuntu-latest
steps:
- name: Deploy to Github Pages
id: deployment
uses: actions/deploy-pages@v4
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create a release on tag
on:
push:
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'npm'

- name: Install Node dependencies
run: npm ci

- name: Build the package
run: |
npm run build:kinto-single
cd build
tar -cvf "$RUNNER_TEMP/kinto-admin-release.tar" *

- name: Create release if one doesn't exist yet
run: |
EXISTING_RELEASE=$(gh release view $GITHUB_REF --json="id" || echo '')
if [[ -z $EXISTING_RELEASE ]]; then
gh release create $GITHUB_REF --generate-notes -d
fi

- name: Upload built package to release
run: |
gh release upload $GITHUB_REF "$RUNNER_TEMP/kinto-admin-release.tar" --clobber
48 changes: 40 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,47 @@ If you use `target.merkle.tree.file.name` it will render the string
`foobar` and `target.proof.hash` will render `abcd`.

## Releasing
Releases can be created through the GitHub UI or through git command line.

### Through GitHub UI
1. Create a new release as normal
2. When tagging your release, enter a standard version number like `vX.Y.Z`
3. After the release is published (including pre-release), built assets will be attached as files, including:
1. Source code based on the tagged commit
2. A single-server build for kinto-admin in a tar file (this may take a few minutes to show up)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. A single-server build for kinto-admin in a tar file (this may take a few minutes to show up)
2. A single-server build meant to be used in a `kinto` installation in a tar file (this may take a few minutes to show up)

Do you think we should explicitly mention that we're setting ASSET_PATH and SINGLE_SERVER?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being verbose can't hurt. Will add.


### Through git commands
1. Tag a commit with `git tag --annotate vX.Y.Z` (this will become the version number in the built release)
2. Push the tag with `git push origin vX.Y.Z` or `git push origin --tags`
3. A new release draft will be created automatically with built assets attached as files, including:
1. Source code based on the tagged commit
2. A single-server build for kinto-admin in a tar file
1. This will have `ASSET_PATH=/v1/admin KINTO_ADMIN_SINGLE_SERVER=1` build property values
2. This may take a few minutes to show up
4. Update the release body with detailed information
5. Publish the release when ready
leplatrem marked this conversation as resolved.
Show resolved Hide resolved

## Deploying to github-pages

### Repo configuration for forks
1. Enable github pages and allow deployment from github actions
1. Go Settings > Pages
2. Under "Build and deployment" choose Source > GitHub Actions
2. Choose which branches should be allowed to deploy to pages
1. Go Settings > Environments > Github Pages
2. Under "Deployment branches and tags", configure which branches should be allowed to deploy to pages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's something that I find unclear in these instructions...
Are they meant to be ran each time? Are they targeted at contributors/forks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to make that clearer


### Deployed automatically on release publish
Github pages will automatically be updated upon release publishing. Version will be the tag created

### Running the github action manually
You can deploy to github pages manually for To deploy to github pages manually for any user acceptance testing you may want to do.
1. Open Actions
2. Select the "Deploy to Github Pages" action
3. Select "Run workflow" and choose the branch you wish to build against
4. Click "Run workflow"
5. Kinto-admin will be deployed to `https://{owner}.github.io/kinto-admin`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why {owner} here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{owner} is the syntax I've seen in the github docs. So the for kinto's repo this would be https://kinto.github.io/kinto-admin, but for my fork it's https://alexcottner.github.io/kinto-admin/ . Is there a way to make this clearer?


1. Bump the version number in `package.json` and run `npm i` to propagate that version to `package-lock.json`
2. Commit with `git commit -a -m "Bump vX.Y.Z"`
3. Create the tag with `git tag vX.Y.Z`
4. Push the commit with `git push`
5. Push the tag with `git push origin vX.Y.Z`
6. Publish to GitHub Pages with `npm run publish-to-gh-pages`
7. Draft a new release with the changelog
8. Done!

## License

Expand Down
Loading