Merge pull request #1955 from glotzerlab/fix-hpmc-potential-energy #601
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
name: GitHub Release | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
branches: | |
- "trunk-*" | |
tags: | |
- "v*" | |
workflow_dispatch: | |
env: | |
name: hoomd | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release: | |
name: Build release tarball | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
path: code | |
- name: Install tools | |
run: sudo apt-get install pcregrep pandoc | |
- name: Determine last tag via git describe | |
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} | |
run: echo "tag=$(git describe --abbrev=0)" >> $GITHUB_ENV | |
working-directory: code | |
# git describe does not return the current tag in tag pushes on GitHub Actions, use GITHUB_REF instead | |
- name: Determine tag from GITHUB_REF | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: echo "tag=$(echo ${GITHUB_REF} | sed -e 's/refs\/tags\///g')" >> $GITHUB_ENV | |
- name: Write version change log | |
run: .github/workflows/make-changelog-md.sh ${tag:1} | tee ${GITHUB_WORKSPACE}/changelog.md | |
working-directory: code | |
- name: Copy source | |
run: cp -R code ${name}-${tag:1} | |
- name: Remove .git | |
run: rm -rf ${name}-${tag:1}/.git && ls -laR ${name}-${tag:1} | |
- name: Tar source | |
run: tar -cvzf ${name}-${tag:1}.tar.gz ${name}-${tag:1} | |
- name: Tar source | |
run: tar -cvJf ${name}-${tag:1}.tar.xz ${name}-${tag:1} | |
- name: Upload release files | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: release | |
path: | | |
*.tar.gz | |
changelog.md | |
publish: | |
name: Publish [GitHub] | |
needs: [release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: release | |
- name: Create release | |
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
files: "*.tar.*" | |
body_path: changelog.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |