1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

Finish migration to GitHub Actions (#4836)

* Fix 'if' condition syntax in Actions workflow

Strings in expressions need to be in single quotes:
https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#literals

* Delete .travis.yml

We moved to GitHub Actions

* Inline git-related environment variables

* Inline the build number variable

* Rename TRAVIS_BRANCH to TW5_BUILD_BRANCH

Since we don't use Travis anymore

* Update developer documentation regardgin which CI service is used

* Document the decision about setting env vars in the workflow file
This commit is contained in:
ento 2020-08-29 02:58:34 -08:00 committed by GitHub
parent e332bb1728
commit ef29d05ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 52 deletions

View File

@ -5,9 +5,6 @@ on:
- master - master
- tiddlywiki-com - tiddlywiki-com
env: env:
COMMIT_CONTEXT: "GitHub build"
COMMIT_EMAIL: "actions@github.com"
COMMIT_NAME: "GitHub Actions"
NODE_VERSION: "12" NODE_VERSION: "12"
jobs: jobs:
test: test:
@ -32,17 +29,23 @@ jobs:
with: with:
node-version: "${{ env.NODE_VERSION }}" node-version: "${{ env.NODE_VERSION }}"
- run: "./bin/ci-pre-build.sh" - run: "./bin/ci-pre-build.sh"
# There's another near-duplicate "Set dynamic environment variables" step in
# the `build-tiddlywiki-com` job.
# These _could_ be extracted as a script (or moved into `ci-pre-build.sh`) to do away with the
# duplication, but, the visibility that comes from having these in the workflow file seems
# valuable. Environment variables are global variables and setting them at the top-level
# makes sense.
# Time to reconsider this decision might be when this setup turns out to be mistake-prone.
- name: "Set dynamic environment variables" - name: "Set dynamic environment variables"
run: | run: |
TRAVIS_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
echo ::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH} echo ::set-env name=TW5_BUILD_BRANCH::${TW5_BUILD_BRANCH}
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number) 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') echo ::set-env name=TW5_BUILD_DETAILS::Prerelease built from branch \'$TW5_BUILD_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/build-site.sh"
- run: "./bin/ci-push.sh" - run: "./bin/ci-push.sh"
env: env:
GH_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }}
TRAVIS_BUILD_NUMBER: ${{ github.run_number }}
build-tiddlywiki-com: build-tiddlywiki-com:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.ref == 'refs/heads/tiddlywiki-com' if: github.ref == 'refs/heads/tiddlywiki-com'
@ -57,14 +60,15 @@ jobs:
with: with:
node-version: "${{ env.NODE_VERSION }}" node-version: "${{ env.NODE_VERSION }}"
- run: "./bin/ci-pre-build.sh" - run: "./bin/ci-pre-build.sh"
# When making a change here, don't forget to see if it also applies to the step
# with the same name in the `build-prerelease` job.
- name: "Set dynamic environment variables" - name: "Set dynamic environment variables"
run: | run: |
TRAVIS_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
echo ::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH} echo ::set-env name=TW5_BUILD_BRANCH::${TW5_BUILD_BRANCH}
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number) 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') echo ::set-env name=TW5_BUILD_DETAILS::Built from branch \'$TW5_BUILD_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/build-site.sh"
- run: "./bin/ci-push.sh" - run: "./bin/ci-push.sh"
env: env:
GH_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }}
TRAVIS_BUILD_NUMBER: ${{ github.run_number }}

View File

@ -1,35 +0,0 @@
language: node_js
node_js:
- "12"
stages:
- name: test
- name: build-prerelease
if: branch = "master" AND type = push AND fork = false
- name: build-tiddlywiki-com
if: branch = "tiddlywiki-com" AND type = push AND fork = false
jobs:
include:
- stage: test
script: ./bin/test.sh
- stage: build-prerelease
script:
- ./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/ci-push.sh || travis_terminate 1
- stage: build-tiddlywiki-com
script:
- ./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/ci-push.sh || travis_terminate 1

View File

@ -5,13 +5,13 @@
cd output || exit 1 cd output || exit 1
git config --global user.email "${COMMIT_EMAIL:-travis@travis-ci.org}" || exit 1 git config --global user.email "actions@github.com" || exit 1
git config --global user.name "${COMMIT_NAME:-Travis CI}" || exit 1 git config --global user.name "GitHub Actions" || exit 1
git add -A . || 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 commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_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 remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null || exit 1

View File

@ -1,8 +1,8 @@
created: 20190115173727727 created: 20190115173727727
modified: 20190115173903645 modified: 20200828094535533
title: Continuous Deployment title: Continuous Deployment
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
TiddlyWiki 5 uses [[Travis CI|https://travis-ci.org/]] for continuous deployment. It is driven by the `.travis.yml` file in the root of the repo, along with the scripts in the `bin` folder that it invokes. TiddlyWiki 5 uses [[GitHub Actions|https://docs.github.com/en/actions]] for continuous deployment. It is driven by the workflow file `.github/workflows/ci.yml` in the repo, along with the scripts in the `bin` folder that it invokes.
The build history can be seen at https://travis-ci.org/Jermolene/TiddlyWiki5 The build history can be seen at https://github.com/Jermolene/TiddlyWiki5/actions