aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authormitchell <70453897+orbitalquark@users.noreply.github.com>2020-09-13 21:57:22 -0400
committermitchell <70453897+orbitalquark@users.noreply.github.com>2020-09-13 21:57:22 -0400
commitb80f5edb93492050638887ca974e2298f30df283 (patch)
treec31d39543fb18fb2182707828c06623ffe716eed /.github
parent04a34b21f5eb5b062e1b00632b2d92b934111b83 (diff)
downloadtextadept-b80f5edb93492050638887ca974e2298f30df283.tar.gz
textadept-b80f5edb93492050638887ca974e2298f30df283.zip
Added initial GitHub workflow for [nightly] builds.
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/cleanup.yml13
-rw-r--r--.github/workflows/release.yml135
2 files changed, 148 insertions, 0 deletions
diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml
new file mode 100644
index 00000000..5f71decf
--- /dev/null
+++ b/.github/workflows/cleanup.yml
@@ -0,0 +1,13 @@
+name: cleanup
+on:
+ schedule:
+ - cron: '15 4 * * *'
+
+jobs:
+ cleanup:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Remove build artifacts
+ uses: c-hive/gha-remove-artifacts@v1
+ with:
+ age: '1 minute'
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..103c2605
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,135 @@
+name: release
+on:
+ schedule:
+ - cron: "0 4 * * *"
+ workflow_dispatch:
+ inputs:
+ args:
+ description: Make arguments
+ default: release-all
+ tag:
+ description: Optional release tag (normally auto-detected)
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ container: ghcr.io/orbitalquark/textadept-build:v1.0
+ outputs:
+ version: ${{ steps.build.outputs.version }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Git init if necessary
+ shell: bash
+ run: |
+ # If git version is less than 2.18, a git clone will not be made in
+ # this container. In that case, make a temporary repository so
+ # "make release" can archive the repo's contents for release.
+ if [[ -d .git ]]; then exit 0; fi
+ git init
+ git add .
+ git config --global user.email "none@example.com"
+ git config --global user.name "none"
+ git commit -m 'none'
+ - name: Checkout textadept-build dependencies
+ uses: actions/checkout@v2
+ with:
+ repository: orbitalquark/textadept-build
+ path: textadept-build
+ - name: Checkout textadept-modules
+ uses: actions/checkout@v2
+ with:
+ repository: orbitalquark/textadept-modules
+ path: textadept-modules
+ - name: Build
+ id: build
+ shell: bash
+ run: |
+ # Move cached dependencies into src/.
+ mv textadept-build/* src
+ rm -r textadept-build
+
+ # Temporarily zip up modules since anything named "textadept*" in root
+ # is deleted by "make clean".
+ zip -r src/textadept.modules.zip textadept-modules
+ rm -r textadept-modules
+
+ # Build.
+ if [[ ${{ github.event_name }} != schedule ]]; then
+ args="${{ github.event.inputs.args }}"
+ else
+ args="release-all NIGHTLY=1 DEBUG=1"
+ fi
+ make -C src $args
+
+ # For nightly builds, strip the date from filenames.
+ for file in `ls src/textadept_nightly* 2>/dev/null`; do
+ mv $file `echo $file | sed 's/_[0-9]\{4\}\(-[0-9]\{2\}\)\{2\}//;'`
+ done
+
+ # Output version information for use in later steps.
+ version="${{ github.event.inputs.tag }}"
+ if [[ -z $version ]]; then
+ version=`ls -1 src/textadept_*.zip | head -1 |
+ sed -e 's/[^_]\+_\(.\+\)\.[^.]\+\.zip/\1/;'`
+ fi
+ echo "::set-output name=version::$version"
+
+ # Rename and sign modules zip now that the version is known.
+ mv src/textadept.modules.zip src/textadept_$version.modules.zip
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v2
+ with:
+ name: artifacts
+ path: |
+ src/textadept_*
+ docs/changelog.md
+ tag:
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Tag
+ run: |
+ git tag textadept_${{ needs.build.outputs.version }}
+ git push -f origin textadept_${{ needs.build.outputs.version }}
+ release:
+ runs-on: ubuntu-latest
+ needs: [build, tag]
+ steps:
+ - name: Download artifacts
+ uses: actions/download-artifact@v2
+ with:
+ name: artifacts
+ - name: Create release log
+ shell: bash
+ run: |
+ echo -n "Textadept " > log.md
+ echo -n "${{ needs.build.outputs.version }} " | tr '_' ' ' >> log.md
+ echo \(`date +"%d %b %Y"`\) >> log.md
+ if [[ ${{ needs.build.outputs.version }} = nightly ]]; then exit 0; fi
+ prefix="https://orbitalquark.github.io/textadept"
+ echoing=0
+ while read line; do
+ if [[ $line == \#\#\#* ]]; then
+ if [[ $echoing -eq 0 ]]; then
+ echoing=1
+ else
+ exit 0
+ fi
+ elif [[ $echoing -eq 1 ]]; then
+ echo "$line" | grep -v '\(\[Textadept\|Download:\)' |
+ sed "s,\(manual\|api\)\.html,$prefix/\0,;" || continue
+ fi
+ done < docs/changelog.md >> log.md
+ - name: Create release
+ uses: ncipollo/release-action@v1
+ with:
+ name: ${{ needs.build.outputs.version }}
+ tag: textadept_${{ needs.build.outputs.version }}
+ prerelease: ${{ needs.build.outputs.version == 'nightly' }}
+ allowUpdates: true
+ bodyFile: log.md
+ artifacts: src/textadept_*
+ token: ${{ secrets.GITHUB_TOKEN }}