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 '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 }}