Skip to content

Commit d61dd8c

Browse files
committed
release ci job
1 parent 6020e05 commit d61dd8c

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/main.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ name: docker CI
77
on:
88
push:
99
branches: [ master ]
10+
tags: [ "v*.*.*" ]
1011
pull_request:
1112
branches: [ master ]
1213

@@ -62,3 +63,60 @@ jobs:
6263
./coq.hb reset `find . -name \*.v`
6364
mv _CoqProject.test-suite.bak _CoqProject.test-suite
6465
git diff --exit-code
66+
67+
release:
68+
runs-on: ubuntu-latest
69+
if: startsWith(github.ref, 'refs/tags/')
70+
needs: [opam]
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v3
74+
75+
- name: Inject slug/short variables
76+
uses: rlespinasse/github-slug-action@v4
77+
78+
- name: Create archive
79+
run: |
80+
VERSION="${GITHUB_REF_NAME_SLUG#v}"
81+
git archive -o hierarchy-builder-$VERSION.tar.gz --prefix=hierarchy-builder-$VERSION/ $GITHUB_SHA .
82+
83+
- name: Release
84+
uses: softprops/action-gh-release@v1
85+
with:
86+
files: hierarchy-builder-*.tar.gz
87+
fail_on_unmatched_files: true
88+
prerelease: true
89+
generate_release_notes: true
90+
name: Hierarchy Builder ${{ github.ref }}
91+
92+
- name: Use OCaml 4.14.x
93+
uses: avsm/setup-ocaml@v2
94+
with:
95+
ocaml-compiler: 4.14.x
96+
opam-local-packages: |
97+
!coq-hierarchy-builder*.opam
98+
99+
- name: Write PAT
100+
env:
101+
OPAM_PUBLISH_TOKEN: ${{ secrets.OPAM_PUBLISH_TOKEN }}
102+
run: |
103+
mkdir -p ~/.opam/plugins/opam-publish
104+
printf "$OPAM_PUBLISH_TOKEN" > ~/.opam/plugins/opam-publish/coqelpibot.token
105+
106+
- name: Setup SSH
107+
uses: webfactory/[email protected]
108+
with:
109+
ssh-private-key: ${{ secrets.BOT_SSH_KEY }}
110+
111+
- name: Install opam-publish # 2.0.3 because more recent versions do not respect OPAMYES
112+
run: opam install -y -j 2 opam-publish=2.0.3
113+
114+
- name: Publish
115+
run: |
116+
eval $(opam env)
117+
git config --global user.name coqelpibot
118+
git config --global user.email [email protected]
119+
OPAM_SUITE=released
120+
TAG=`git tag --sort=-v:refname|head -1`
121+
opam-publish --tag=$TAG --packages-directory=$OPAM_SUITE/packages --repo=coq/opam --no-browser -v ${TAG##v} https://github.com/math-comp/hierarchy-builder/releases/download/$TAG/hierarchy-builder-${TAG##v}.tar.gz
122+

0 commit comments

Comments
 (0)