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

Build and release pipelines for Gist Web #10

Merged
merged 2 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build Gist Web
run-name: Build gist-web - ${{ github.event.commits[0].message }}

on:
push:
branches:
- 'develop'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: 16
- name: Build
shell: bash
run: |
npm install
npm run build:prod
- name: Merge to develop
shell: bash
run: |
git config user.name "ami-ci"
git config user.email "<>"
git checkout develop
git add .
set +e # Grep succeeds with nonzero exit codes to show results.
git status | grep modified
if [ $? -eq 0 ]
then
set -e
git commit -am "New version of gist-web"
git push
else
set -e
echo "No changes since last run"
fi
- name: Release to master
shell: bash
run: |
git merge origin/master
git checkout master
git merge develop
git push origin master
echo "Release complete"
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Gist Web
run-name: Release gist-web

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.GIST_WEB_AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.GIST_WEB_AWS_SECRET_ACCESS_KEY }}
AWS_BUCKET: 'gist-code'
steps:
- uses: actions/checkout@v3
with:
ref: 'master'
- name: Version name
shell: bash
run: |
RELEASE_VERSION="${GITHUB_REF#refs/*/}"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION"

AWS_DEST="web/$RELEASE_VERSION"
echo "AWS_DEST=$AWS_DEST" >> $GITHUB_ENV
echo "AWS_DEST=$AWS_DEST"
- uses: shallwefootball/s3-upload-action@master
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we specify permissions? If uploaded with default permissions only the admin has read permissions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can specify otherwise, but the action by default makes it publicly readable.

with:
aws_key_id: ${{ env.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws_bucket: ${{ env.AWS_BUCKET }}
source_dir: 'dist'
destination_dir: ${{ env.AWS_DEST }}
endpoint: 'ams3.digitaloceanspaces.com'