-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add deploy job to CI to publish new releases when tag is put. #49
Comments
Note that |
Thanks for the info. I hadn't realized |
I guess the main problem they faced is how to infer certain configuration options without requiring cumbersome config files. |
OK, thanks for the additional info. So either we propose changes to |
Note that https://github.com/ejgallego/coq-plugin-template includes reasonable support for using |
@gares might have some hints for us since he recently automated a similar workflow opening a PR for Elpi, see example, and also this Coq Zulip topic. |
We looked into dune-release (I use it for elpi for example), but it seems it does not work for vscoq since the opam package (and dune project) are in a subdirectory: tarides/dune-release#471 Also I did not find any use of it in CI, but the doc suggests setting env variables should be enough. Then we looked into opam-publish which does fewer things and we paired it with a simple action to build a tarball an create a draft release. With some hacks one can convince opam-publish to run in batch mode and open a PR. So we used it in vscoq, and then I reproduced it in coq-elpi (which is not even a dune project, so it can't use dune-release to begin with). In vscoq @maximedenes did separate the job below into two jobs which always run but don't really do the action in the very end, to keep the CI code tested (I put the Here my job for coq-elpi: release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3 of course you want to run this (or some parts of this) only if the CI runs on a tag and if the other tests worked (here called - name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Create archive
run: |
VERSION="${GITHUB_REF_NAME_SLUG#v}"
git archive -o coq-elpi-$VERSION.tar.gz --prefix=coq-elpi-$VERSION/ $GITHUB_SHA .
- name: Release
uses: softprops/action-gh-release@v1
with:
files: coq-elpi-*.tar.gz
fail_on_unmatched_files: true
prerelease: true
generate_release_notes: true
name: Coq-Elpi ${{ github.ref }} for Coq XXX Since my tags are named like And here the dragons: - name: Use OCaml 4.14.x
uses: avsm/setup-ocaml@v2
with:
ocaml-compiler: 4.14.x
opam-local-packages: |
!coq-elpi.opam You need ocaml for opam-publish. The action also tries to install the dependencies of the opam files it finds at the root of your project (which is useless here, since we need ocaml opam-publish and not elpi, and also may require non strandard opam repos making it fail). Miraculously it does not look into subfolders (so vscoq CI job does not need the last option). - 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/coqelpibot.token You need to issue an access token from the bot account (just google for PAT), take an old token format otherwise the new ones expire in at most 1 year, put it into a secret, then "preseed" opam-publish configuration. - name: Setup SSH
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.BOT_SSH_KEY }} The bot needs an ssh key, the private part is stored in this secret, the action does the rest. - name: Install opam-publish # 2.0.3 because more recent versions do not respect OPAMYES
run: opam install -y -j 2 opam-publish=2.0.3 Why would it work out of the box? - name: Publish
run: |
eval $(opam env)
git config --global user.name coqelpibot
git config --global user.email coqelpibot@inria.fr
OPAM_SUITE=released
TAG=`git tag --sort=-v:refname|head -1`
opam-publish --tag=$TAG --packages-directory=$OPAM_SUITE/packages --repo=coq/opam --no-browser -v ${TAG##v} https://github.com/LPCIC/coq-elpi/releases/download/$TAG/coq-elpi-${TAG##v}.tar.gz You want to prepare a commit for coq/opam, the author is the bot. |
One thing I did not understand is where the github user name (of the bot) is written. I did the fork of the repo myself (using the bot account). I don't know if it is necessary. opam-publish for sure does a git clone of it, I don't know if it is able to do the fork. Since the cloning was not working I tried doing the fork, but it did not solve the problem (or at least, was not sufficient). In any case, you have to do the fork only once. |
Dear @gares,
I opened an issue: ocaml-opam/opam-publish#132 |
FYI @Zimmi48 @gares, the opam-publish maintainers just released version 2.3.0, which contains a new option
|
Meta-issue
The idea is simply to make it as easy as possible for principal maintainers of coq-community packages to publish a new release.
When pushing a new tag, the deploy job would:
coqPackages
.A question is how to include the release date meta-data in the opam file that is published in the opam repository. Either the maintainer updates the date in
meta.yml
before tagging (but I expect people to forget), or we add it later (but then we can't use opam-publish as-is).The text was updated successfully, but these errors were encountered: