.github/workflows/publish-server.yml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to use for release' | |
required: true | |
default: ${GITHUB_REF_NAME#v} | |
prerelease: | |
description: 'Is this a pre-release' | |
required: true | |
default: false | |
jobs: | |
publish-opam-package: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
ocaml-compiler: [4.14.x] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use OCaml ${{ matrix.ocaml-compiler }} | |
uses: avsm/setup-ocaml@v3 | |
with: | |
ocaml-compiler: ${{ matrix.ocaml-compiler }} | |
- name: Install opam-publish | |
run: opam install -y -j 2 opam-publish=2.5.0 | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.BOT_SSH_KEY }} | |
- name: Write PAT | |
env: | |
OPAM_PUBLISH_TOKEN: ${{ secrets.OPAM_PUBLISH_TOKEN }} | |
run: | | |
mkdir -p ~/.opam/plugins/opam-publish | |
printf "$OPAM_PUBLISH_TOKEN" > ~/.opam/plugins/opam-publish/vscoqbot.token | |
- name: Create archive | |
run: | | |
VERSION_SLUG="${{ github.event.inputs.tag }}" | |
VERSION="${VERSION_SLUG#v}" | |
cd language-server | |
git archive -o vscoq-language-server-$VERSION.tar.gz --prefix=vscoq-language-server-$VERSION/ $VERSION_SLUG . | |
- name: Release archive | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: vscoq-language-server-*.tar.gz | |
fail_on_unmatched_files: true | |
prerelease: ${{ github.event.inputs.prerelease }} | |
append_body: true | |
- name: Publish release | |
if: ${{ !github.event.inputs.prerelease }} | |
run: | | |
eval $(opam env) | |
VERSION_SLUG="${{ github.event.inputs.tag }}" | |
VERSION="${VERSION_SLUG#v}" | |
cd language-server | |
git config --global user.name vscoqbot | |
git config --global user.email [email protected] | |
opam publish --no-confirmation --no-browser -v $VERSION https://github.com/coq/vscoq/releases/download/$VERSION_SLUG/vscoq-language-server-$VERSION.tar.gz vscoq-language-server.opam | |
- name: Publish prerelease | |
if: ${{ github.event.inputs.prerelease }} | |
run: | | |
eval $(opam env) | |
VERSION_SLUG="${{ github.event.inputs.tag }}" | |
VERSION="${VERSION_SLUG#v}" | |
cd language-server | |
git config --global user.name vscoqbot | |
git config --global user.email [email protected] | |
opam publish --no-confirmation --no-browser --packages-directory=extra-dev/packages --repo=coq/opam -v $VERSION https://github.com/coq/vscoq/releases/download/$VERSION_SLUG/vscoq-language-server-$VERSION.tar.gz vscoq-language-server.opam |