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:
ento 2020-08-28 08:31:57 -08:00 committed by GitHub
parent 4f376fba35
commit a206dccf0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 25 deletions

70
.github/workflows/ci.yml vendored Normal file
View 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 }}