-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(*.yml): Move opam-publish in a separate workflow to enable testing
* Follow https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow * Use `opam-publish>=2.3.0` that offers a new flag `--no-confirmation`
- Loading branch information
Showing
4 changed files
with
123 additions
and
103 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: OPAM Publish | ||
# See also release.yml | ||
# and https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
release: | ||
type: string | ||
# not boolean | ||
# see also https://github.com/actions/runner/issues/1483#issuecomment-1372133232 | ||
required: false | ||
default: "false" | ||
tag_name: | ||
type: string | ||
required: true | ||
default: "v0.1.0" | ||
body: | ||
type: string | ||
required: true | ||
default: "## 0.1.0" | ||
secrets: | ||
OPAM_RELEASE: | ||
required: true | ||
# = proofbot.token | ||
|
||
jobs: | ||
opam-release: | ||
name: Publish to opam registry | ||
env: | ||
# Note: Update if need be | ||
source_repo: "ocaml-sf/learn-ocaml" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
- name: Prepare target package repository | ||
id: prep | ||
run: | | ||
# Test inputs.release | ||
if [ "${{ inputs.release }}" = 'true' ]; then | ||
echo "opam_repo=ocaml/opam-repository" >> "$GITHUB_OUTPUT" | ||
echo "release mode: target ocaml/opam-repository" | ||
else | ||
# Note: Update if need be | ||
echo "opam_repo=erikmd/opam-repository" >> "$GITHUB_OUTPUT" | ||
echo "dry-run mode: target erikmd/opam-repository" | ||
fi | ||
- name: Setup bot user | ||
run: | | ||
# Note: Update if need be | ||
git config --global user.email "37002148+proofbot@users.noreply.github.com" | ||
git config --global user.name "Learn-OCaml Bot" | ||
# Some hacks to make sure opam doesn't pull the repo in a way we can't deal with | ||
- name: Setup opam repository and token | ||
env: | ||
var_opam_repo: ${{ steps.prep.outputs.opam_repo }} | ||
run: | | ||
mkdir -v -p ~/.opam/plugins/opam-publish/repos/ | ||
git clone https://github.com/$var_opam_repo ~/.opam/plugins/opam-publish/repos/${var_opam_repo/\//%} | ||
cd ~/.opam/plugins/opam-publish/repos/${var_opam_repo/\//%} | ||
git remote add user https://${{ secrets.OPAM_RELEASE }}@github.com/proofbot/opam-repository | ||
echo -n ${{ secrets.OPAM_RELEASE }} > ~/.opam/plugins/opam-publish/proofbot.token | ||
- name: Generate CHANGES file | ||
env: | ||
CHANGES: ${{ inputs.body }} | ||
run: | | ||
printf "%s" "$CHANGES" > CHANGES.md | ||
# TODO: Docker-based caching | ||
- name: Setup OCaml | ||
uses: avsm/setup-ocaml@v1 | ||
# TODO: Keep up-to-date! | ||
with: | ||
ocaml-version: 4.12.0 | ||
- name: Install opam-publish | ||
run: | | ||
opam install -y -j 2 "opam-publish>=2.3.0" | ||
# - name: Install expect | ||
# # not needed anymore | ||
# run: | | ||
# sudo apt-get update -y -q | ||
# sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends expect | ||
- name: Publish to opam | ||
env: | ||
var_opam_repo: ${{ steps.prep.outputs.opam_repo }} | ||
run: | | ||
export GIT_PAGER=cat | ||
opam publish --no-browser --no-confirmation --msg-file=CHANGES.md --tag="${{ inputs.tag_name }}" --repo="$var_opam_repo" "$source_repo" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Test OPAM Publish | ||
# See also release.yml | ||
# and https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow | ||
on: | ||
# pull_request: | ||
# branches: | ||
# - "master" | ||
push: | ||
branches: | ||
- "**-gha" | ||
- "preflight" | ||
# or called from workflow "Release" | ||
|
||
jobs: | ||
call-opam-publish: | ||
uses: ./.github/workflows/opam-publish.yml | ||
with: | ||
# release: "false" # by default | ||
tag_name: "v0.15.0" | ||
body: | | ||
## [0.15.0](https://github.com/ocaml-sf/learn-ocaml/compare/v0.14.1...v0.15.0) (2023-08-23) | ||
### Features | ||
* **partition-view:** Add a selector to show (tokens, nicks, or anon IDs) (`#540`) ([58b3644](https://github.com/ocaml-sf/learn-ocaml/commit/58b3644a6d5a3f43cf8d7cb21ebbe40b588f176f)), closes `#528` | ||
* etc. | ||
secrets: | ||
OPAM_RELEASE: ${{ secrets.OPAM_RELEASE }} |
This file was deleted.
Oops, something went wrong.