mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Add GitHub Actions workflow (#4793)
* Parameterize strings that mention Travis This is so that the script can be shared with GitHub Actions while we make the transition. * Add GitHub Actions workflow More or less a direct translation of .travis.yml * Rename scripts that mention travis * Fix typo
This commit is contained in:
parent
4f376fba35
commit
a206dccf0a
70
.github/workflows/ci.yml
vendored
Normal file
70
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- tiddlywiki-com
|
||||
env:
|
||||
COMMIT_CONTEXT: "GitHub build"
|
||||
COMMIT_EMAIL: "actions@github.com"
|
||||
COMMIT_NAME: "GitHub Actions"
|
||||
NODE_VERSION: "12"
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/test.sh"
|
||||
build-prerelease:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == "refs/heads/master"
|
||||
needs: test
|
||||
env:
|
||||
TW5_BUILD_TIDDLYWIKI: "./tiddlywiki.js"
|
||||
TW5_BUILD_MAIN_EDITION: "./editions/prerelease"
|
||||
TW5_BUILD_OUTPUT: "./output/prerelease"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/ci-pre-build.sh"
|
||||
- name: "Set dynamic environment variables"
|
||||
run: |
|
||||
TRAVIS_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
||||
echo ::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH}
|
||||
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number)
|
||||
echo ::set-env name=TW5_BUILD_DETAILS::Prerelease built from branch \'$TRAVIS_BRANCH\' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')
|
||||
- run: "./bin/build-site.sh"
|
||||
- run: "./bin/ci-push.sh"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }}
|
||||
TRAVIS_BUILD_NUMBER: ${{ github.run_number }}
|
||||
build-tiddlywiki-com:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == "refs/heads/tiddlywiki-com"
|
||||
needs: test
|
||||
env:
|
||||
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
|
||||
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
||||
TW5_BUILD_OUTPUT: "./output"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/ci-pre-build.sh"
|
||||
- name: "Set dynamic environment variables"
|
||||
run: |
|
||||
TRAVIS_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
||||
echo ::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH}
|
||||
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number)
|
||||
echo ::set-env name=TW5_BUILD_DETAILS::Built from branch \'$TRAVIS_BRANCH\' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')
|
||||
- run: "./bin/build-site.sh"
|
||||
- run: "./bin/ci-push.sh"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }}
|
||||
TRAVIS_BUILD_NUMBER: ${{ github.run_number }}
|
@ -15,21 +15,21 @@ jobs:
|
||||
script: ./bin/test.sh
|
||||
- stage: build-prerelease
|
||||
script:
|
||||
- ./bin/travis-pre-build.sh
|
||||
- ./bin/ci-pre-build.sh
|
||||
- export TW5_BUILD_TIDDLYWIKI='./tiddlywiki.js'
|
||||
- export TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)
|
||||
- export TW5_BUILD_DETAILS="Prerelease built from branch '$TRAVIS_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')"
|
||||
- export TW5_BUILD_MAIN_EDITION='./editions/prerelease'
|
||||
- export TW5_BUILD_OUTPUT='./output/prerelease'
|
||||
- ./bin/build-site.sh || travis_terminate 1
|
||||
- ./bin/travis-push.sh || travis_terminate 1
|
||||
- ./bin/ci-push.sh || travis_terminate 1
|
||||
- stage: build-tiddlywiki-com
|
||||
script:
|
||||
- ./bin/travis-pre-build.sh
|
||||
- ./bin/ci-pre-build.sh
|
||||
- export TW5_BUILD_TIDDLYWIKI='./node_modules/tiddlywiki/tiddlywiki.js'
|
||||
- export TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)
|
||||
- export TW5_BUILD_DETAILS="Built from branch '$TRAVIS_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')"
|
||||
- export TW5_BUILD_MAIN_EDITION='./editions/tw5.com'
|
||||
- export TW5_BUILD_OUTPUT='./output'
|
||||
- ./bin/build-site.sh || travis_terminate 1
|
||||
- ./bin/travis-push.sh || travis_terminate 1
|
||||
- ./bin/ci-push.sh || travis_terminate 1
|
||||
|
20
bin/ci-push.sh
Executable file
20
bin/ci-push.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Push output back to GitHub
|
||||
|
||||
|
||||
cd output || exit 1
|
||||
|
||||
git config --global user.email "${COMMIT_EMAIL:-travis@travis-ci.org}" || exit 1
|
||||
|
||||
git config --global user.name "${COMMIT_NAME:-Travis CI}" || exit 1
|
||||
|
||||
git add -A . || exit 1
|
||||
|
||||
git commit --message "${COMMIT_CONTEXT:-Travis build}: $TRAVIS_BUILD_NUMBER of $TRAVIS_BRANCH ($(date +'%F %T %Z'))" || exit 1
|
||||
|
||||
git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null || exit 1
|
||||
|
||||
git push deploy master &>/dev/null || exit 1
|
||||
|
||||
cd .. || exit 1
|
@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Push output back to GitHub
|
||||
|
||||
|
||||
cd output || exit 1
|
||||
|
||||
git config --global user.email "travis@travis-ci.org" || exit 1
|
||||
|
||||
git config --global user.name "Travis CI" || exit 1
|
||||
|
||||
git add -A . || exit 1
|
||||
|
||||
git commit --message "Travis build: $TRAVIS_BUILD_NUMBER of $TRAVIS_BRANCH ($(date +'%F %T %Z'))" || exit 1
|
||||
|
||||
git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null || exit 1
|
||||
|
||||
git push deploy master &>/dev/null || exit 1
|
||||
|
||||
cd .. || exit 1
|
Loading…
Reference in New Issue
Block a user