Skip to content
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

workflows: automatically create GitHub release when tagged #67

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
- [ ] Run test build and `meson dist`
- [ ] Update `CHANGELOG.md` and versions in `configure.ac` and `meson.build`
- [ ] Create and push signed tag
- [ ] `git clean -dxf && meson setup builddir && meson dist -C builddir`
- [ ] Attach release notes to [GitHub release](https://github.com/openslide/openslide-java/releases/new), set pre-release flag, and upload tarball
- [ ] Verify that GitHub Actions created a [GitHub release](https://github.com/openslide/openslide-java/releases) with release notes and a source tarball
- [ ] [Update openslide-bin](https://github.com/openslide/openslide-bin/issues/new?labels=release&template=release.md)
- [ ] Update website: `_data/releases.yaml`, `_includes/news.md`
- [ ] Send mail to -announce and -users
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
outputs:
dist-base: ${{ steps.dist.outputs.dist-base }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
dist: dist
steps:
- name: Check out repo
uses: actions/checkout@v4
Expand All @@ -36,3 +41,50 @@ jobs:
meson install -C builddir
- name: Smoke test
run: java -cp builddir/openslide.jar org.openslide.TestCLI fixtures/small.svs
- name: Dist
id: dist
if: matrix.dist
run: |
meson dist -C builddir
dist="openslide-java-dist-$GITHUB_RUN_NUMBER-$(echo $GITHUB_SHA | cut -c-10)"
echo "dist-base=$dist" >> $GITHUB_OUTPUT
mkdir -p "artifacts/$dist"
mv builddir/meson-dist/*.tar.xz "artifacts/$dist"
- name: Archive dist
if: matrix.dist
uses: actions/upload-artifact@v4
with:
name: ${{ steps.dist.outputs.dist-base }}
path: artifacts
compression-level: 0

release:
name: Release
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
concurrency: release-${{ github.ref }}
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: ${{ needs.build.outputs.dist-base }}
merge-multiple: true
- name: Release to GitHub
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
version=$(echo "${{ github.ref_name }}" | sed "s/^v//")
tar xf "${{ needs.build.outputs.dist-base }}/openslide-java-${version}.tar.xz"
awk -e '/^## / && ok {exit}' \
-e '/^## / {ok=1; next}' \
-e 'ok {print}' \
"openslide-java-${version}/CHANGELOG.md" > changes
gh release create --prerelease --verify-tag \
--repo "${{ github.repository }}" \
--title "OpenSlide Java $version" \
--notes-file changes \
"${{ github.ref_name }}" \
"${{ needs.build.outputs.dist-base }}/"*