diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26721707f..676a32c9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,9 +5,6 @@ on: - master - tiddlywiki-com env: - COMMIT_CONTEXT: "GitHub build" - COMMIT_EMAIL: "actions@github.com" - COMMIT_NAME: "GitHub Actions" NODE_VERSION: "12" jobs: test: @@ -32,17 +29,23 @@ jobs: with: node-version: "${{ env.NODE_VERSION }}" - 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" run: | - TRAVIS_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') - echo ::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH} + TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') + 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_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/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' @@ -57,14 +60,15 @@ jobs: with: node-version: "${{ env.NODE_VERSION }}" - 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" run: | - TRAVIS_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') - echo ::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH} + TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') + 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_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/ci-push.sh" env: GH_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }} - TRAVIS_BUILD_NUMBER: ${{ github.run_number }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b714cf477..000000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/bin/ci-push.sh b/bin/ci-push.sh index 97a06e64e..670d2acdf 100755 --- a/bin/ci-push.sh +++ b/bin/ci-push.sh @@ -5,13 +5,13 @@ 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 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 diff --git a/editions/dev/tiddlers/Continuous Deployment.tid b/editions/dev/tiddlers/Continuous Deployment.tid index f516b1be5..3ea44245f 100644 --- a/editions/dev/tiddlers/Continuous Deployment.tid +++ b/editions/dev/tiddlers/Continuous Deployment.tid @@ -1,8 +1,8 @@ created: 20190115173727727 -modified: 20190115173903645 +modified: 20200828094535533 title: Continuous Deployment 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