2020-07-08 11:12:21 +00:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
|
|
|
release: # Docs: <https://git.io/JeBz1#release-event-release>
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
demo:
|
|
|
|
name: Update demonstration, hosted on github pages
|
2021-03-04 06:28:48 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2020-07-08 11:12:21 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup NodeJS
|
|
|
|
uses: actions/setup-node@v1 # Action page: <https://github.com/actions/setup-node>
|
|
|
|
with:
|
|
|
|
node-version: 12
|
|
|
|
|
|
|
|
- name: Generate version value
|
|
|
|
run: echo "::set-env name=PACKAGE_VERSION::${GITHUB_REF##*/v}"
|
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: '**/node_modules'
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2020-07-08 17:56:45 +00:00
|
|
|
run: yarn install
|
|
|
|
|
|
|
|
- name: Generate pages
|
2020-07-08 17:15:53 +00:00
|
|
|
run: ./bin/generator.js -c ./config.json -o ./out
|
2020-07-08 11:12:21 +00:00
|
|
|
|
2020-07-08 17:56:45 +00:00
|
|
|
- name: Copy static files
|
|
|
|
run: cp ./static/* ./out
|
|
|
|
|
2020-07-08 11:12:21 +00:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: content
|
|
|
|
path: out/
|
|
|
|
|
|
|
|
- name: Switch to github pages branch
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: gh-pages
|
|
|
|
|
|
|
|
- name: Download artifact
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: content
|
|
|
|
|
|
|
|
- name: Setup git
|
|
|
|
run: |
|
|
|
|
git config --global user.name "$GITHUB_ACTOR"
|
|
|
|
git config --global user.email 'actions@github.com'
|
|
|
|
git remote add github "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git"
|
|
|
|
|
|
|
|
- name: Stage changes
|
|
|
|
run: git add .
|
|
|
|
|
|
|
|
- name: Commit changes
|
2020-07-08 17:46:17 +00:00
|
|
|
run: git commit --allow-empty -m "Deploying ${GITHUB_SHA} to Github Pages"
|
2020-07-08 11:12:21 +00:00
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
run: git push github --force
|
|
|
|
|
|
|
|
docker-image:
|
|
|
|
name: Build docker image
|
2021-03-04 06:28:48 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2020-07-08 11:12:21 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
|
|
|
- name: Generate image tag value
|
|
|
|
run: echo "::set-env name=IMAGE_TAG::${GITHUB_REF##*/[vV]}" # `/refs/tags/v1.2.3` -> `1.2.3`
|
|
|
|
|
|
|
|
- name: Make docker login
|
|
|
|
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_LOGIN }}" --password-stdin &> /dev/null
|
|
|
|
|
|
|
|
- name: Build image
|
2020-07-08 11:22:29 +00:00
|
|
|
run: docker build --tag "tarampampam/error-pages:${IMAGE_TAG}" --tag "tarampampam/error-pages:latest" -f ./Dockerfile .
|
2020-07-08 11:12:21 +00:00
|
|
|
|
|
|
|
- name: Push version image
|
2020-07-08 11:22:29 +00:00
|
|
|
run: docker push "tarampampam/error-pages:${IMAGE_TAG}"
|
2020-07-08 11:12:21 +00:00
|
|
|
|
|
|
|
- name: Push latest image
|
2020-07-08 11:22:29 +00:00
|
|
|
run: docker push "tarampampam/error-pages:latest"
|