diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml new file mode 100644 index 0000000..4b0d2fd --- /dev/null +++ b/.github/workflows/build-test-release.yml @@ -0,0 +1,23 @@ +name: Build, test, release +on: [push, pull_request] +jobs: + build-test: + uses: ./.github/workflows/build.yml + + prep-release: + if: github.ref == format('refs/heads/v{0}', needs.build-test.outputs.pv) + needs: build-test + permissions: + contents: write + uses: ./.github/workflows/prepare-release.yml + with: + publish: true + + release: + if: github.ref == format('refs/heads/v{0}', needs.build-test.outputs.pv) + needs: [build-test, prep-release] + uses: ./.github/workflows/release.yml + with: + release_tag: ${{ needs.prep-release.outputs.release_tag }} + secrets: + maintainer_key: ${{ secrets.maintainer_key }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d2de942 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,10 @@ +name: Build +on: + - workflow_dispatch + - workflow_call +jobs: + build-test: + uses: cygporter/workflows/.github/workflows/build-test.yml@v1 + with: + cygport_file: asciidoc.cygport + bootstrap_packages: cygport python3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index e8754a8..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: CI -on: [push, pull_request] -jobs: - ci: - runs-on: windows-latest - defaults: - run: - shell: bash --noprofile --norc -e -o pipefail -o igncr {0} - env: - PATH: C:\cygwin\bin - steps: - - name: Install starting Cygwin packages - uses: cygwin/cygwin-install-action@v2 - with: - packages: git cygport python3 - timeout-minutes: 10 - - name: Manually configure safe.directory - run: git config --global --add safe.directory '*' - timeout-minutes: 1 - - name: Checkout - uses: actions/checkout@v3 - with: - set-safe-directory: false # actions/checkout otherwise tries to use the wrong config file, per actions/checkout#767 - timeout-minutes: 1 - - name: Load variables from the cygport file - id: cygport-vars - run: | - eval "$(cygport asciidoc.cygport vars BUILD_REQUIRES PVR)" - printf '::set-output name=packages::%s\n' "$BUILD_REQUIRES" - printf '::set-output name=pvr::%s\n' "$PVR" - timeout-minutes: 1 - - name: Install Cygwin build requirements - uses: cygwin/cygwin-install-action@v2 - with: - packages: ${{ steps.cygport-vars.outputs.packages }} - timeout-minutes: 30 - - name: Generate cygcheck output - if: always() - run: cygcheck -srv >/var/log/cygcheck.out - timeout-minutes: 5 - - name: Store Cygwin logs - if: always() - uses: actions/upload-artifact@v2 - with: - name: cygwin-logs - path: 'C:\cygwin\var\log\' - timeout-minutes: 5 - - name: Cygport download - run: cygport asciidoc.cygport download - timeout-minutes: 5 - - name: Cygport prep - run: cygport asciidoc.cygport prep - timeout-minutes: 1 - - name: Cygport compile - run: cygport asciidoc.cygport compile - timeout-minutes: 5 - - name: Cygport test - run: cygport asciidoc.cygport test - timeout-minutes: 5 - - name: Cygport install - run: cygport asciidoc.cygport install - timeout-minutes: 5 - - name: Cygport package - run: cygport asciidoc.cygport package - timeout-minutes: 5 - - name: Configure SSH - if: github.ref == 'refs/heads/main' - env: - MAINTAINER_KEY: ${{ secrets.MAINTAINER_KEY }} - run: | - umask 0077 - mkdir -p ~/.ssh - echo "$MAINTAINER_KEY" >~/.ssh/id_rsa - echo 'cygwin.com,8.43.85.97 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGqrxexIuyqmCVe33p1HuhUFzsXte5QZKb+BJlsRrvXOpUOJEW2S0kszyAiymeV7AXaYmHDKVRJpGVR+0ua0Xww=' >~/.ssh/known_hosts - timeout-minutes: 1 - - name: Create release tag - if: github.ref == 'refs/heads/main' - env: - PVR: ${{ steps.cygport-vars.outputs.pvr }} - GIT_COMMITTER_NAME: ${{ github.actor }} - GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com - run: | - git tag -am "v$PVR" "v$PVR" - git push origin tag "v$PVR" - timeout-minutes: 1 - - name: Create a GitHub release - if: github.ref == 'refs/heads/main' - uses: softprops/action-gh-release@v1 - with: - tag_name: v${{ steps.cygport-vars.outputs.pvr }} - files: asciidoc-*/dist/asciidoc/* - target_commitish: ${{ github.ref }} - timeout-minutes: 2 - - name: Mirror to Cygwin Git repositories - if: github.ref == 'refs/heads/main' - env: - PVR: ${{ steps.cygport-vars.outputs.pvr }} - run: git push cygwin@cygwin.com:/git/cygwin-packages/asciidoc tag "v$PVR" - timeout-minutes: 5 - - name: Cygport upload - if: github.ref == 'refs/heads/main' - run: SSH_KEY=~/.ssh/id_rsa cygport asciidoc.cygport upload - timeout-minutes: 5 - - name: Tar up build results - if: always() - run: tar -caf asciidoc.txz asciidoc-*-*.*/ - timeout-minutes: 10 - - name: Store build results - if: always() - uses: actions/upload-artifact@v2 - with: - name: build-results - path: asciidoc.txz - if-no-files-found: error - timeout-minutes: 5 diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 0000000..15f0df3 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,36 @@ +name: Prepare release +on: + workflow_dispatch: + inputs: + release_tag: + description: Name for the release tag + required: false + default: '' + type: string + publish: + description: Whether to publish the release + required: false + default: false + type: boolean + workflow_call: + inputs: + release_tag: + description: Name for the release tag + required: false + default: '' + type: string + publish: + description: Whether to publish the release + required: false + default: false + type: boolean +permissions: + contents: write +jobs: + prep-release: + uses: cygporter/workflows/.github/workflows/prep-release.yml@v1 + with: + cygport_file: asciidoc.cygport + release_tag: ${{ inputs.release_tag }} + publish: ${{ inputs.publish }} + bootstrap_packages: cygport python3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d73787b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release +on: + workflow_dispatch: + inputs: + release_tag: + description: Name of the release tag + required: true + type: string + workflow_call: + inputs: + release_tag: + description: Name of the release tag + required: true + type: string + secrets: + maintainer_key: + description: RSA private key for uploading to Cygwin servers in OpenSSH format + required: true + +jobs: + release: + uses: cygporter/workflows/.github/workflows/release.yml@v1 + with: + cygport_file: asciidoc.cygport + tag_name: ${{ inputs.release_tag }} + bootstrap_packages: cygport python3 + secrets: + maintainer_key: ${{ secrets.maintainer_key }} diff --git a/README.md b/README.md index 4eacf23..629866f 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ The canonical version of this repository is [on GitHub][GitHub repo]. Releases Please [contact the Cygwin mailing list][Cygwin lists] in the first instance with any issues / questions / thoughts / &c. -[AsciiDoc]: https://asciidoc.org/ +[AsciiDoc]: https://asciidoc-py.github.io/ [Cygwin]: https://www.cygwin.com/ [Cygwin lists]: https://cygwin.com/lists.html -[GitHub repo]: https://github.com/me-and/Cygwin-AsciiDoc +[GitHub repo]: https://github.com/cygporter/AsciiDoc [Cygwin repo]: https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/asciidoc.git