-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from limakzi/feature/add-release
feat: Add auto-releaser
- Loading branch information
Showing
1 changed file
with
113 additions
and
0 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,113 @@ | ||
--- | ||
|
||
name: release | ||
run-name: release-${{ github.ref_name }} | ||
on: | ||
workflow_dispatch: | ||
release: | ||
types: | ||
- published | ||
|
||
env: | ||
gap-branch: stable-4.13 | ||
revision: ${{ github.event.repository.name }}-${{ github.ref_name }} | ||
archive-file: ${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz | ||
|
||
jobs: | ||
assets-build: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: git -- checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
|
||
- uses: gap-actions/setup-gap@v2 | ||
with: | ||
GAPBRANCH: ${{ env.gap-branch }} | ||
|
||
- name: gap -- build docs | ||
uses: gap-actions/build-pkg-docs@v1 | ||
with: | ||
use-latex: 'true' | ||
|
||
- name: github -- run clean up for tarball | ||
run: | | ||
echo "::group:: cleanup version control metadata" | ||
rm -rvf .git | ||
rm -rvf .svn | ||
echo "::group:: cleanup deployment metadata" | ||
rm -rvf .github | ||
rm -fv .codecov.yaml | ||
rm -fv .codecov.yml | ||
rm -fv .gaplint.yml | ||
rm -fv requirements.txt | ||
echo "::group:: cleanup macos metadata" | ||
find . -name .DS_Store -exec rm -f {} + | ||
echo "::group:: remove tex aux files" | ||
find doc \( -name '*.aux' -o -name '*.bbl' -o -name '*.blg' -o -name '*.brf' -o -name '*.idx' -o -name '*.ilg' -o -name '*.ind' -o -name '*.log' -o -name '*.out' -o -name '*.pnr' -o -name '*.toc' -o -name '*.tst' \) -exec rm -f {} + | ||
- name: pkg -- build an archive | ||
run: | | ||
touch ${{ env.archive-file }} | ||
tar -czf ${{ env.archive-file }} --exclude=${{ env.archive-file }} --transform 's,^\.,${{ env.revision }},' . | ||
- name: github -- upload artifacts | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: | | ||
${{ env.archive-file }} | ||
doc/manual.pdf | ||
update-website: | ||
runs-on: ubuntu-22.04 | ||
needs: assets-build | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: gap-actions/setup-gap@v2 | ||
with: | ||
GAPBRANCH: ${{ env.gap-branch }} | ||
|
||
- name: git -- checkout page | ||
uses: actions/checkout@v4 | ||
with: | ||
path: gh-pages | ||
ref: gh-pages | ||
|
||
- name: website -- download asset to be deployed | ||
uses: robinraju/release-downloader@v1 | ||
with: | ||
tag: ${{ github.ref_name }} | ||
fileName: ${{ env.archive-file }} | ||
|
||
- name: website -- extract the archive | ||
run: | | ||
tar -xvf ${{ env.archive-file }} | ||
- name: metadata -- copy metada to update page | ||
run: | | ||
rm -rf ./gh-pages/doc | ||
cp -r ${{ env.revision }}/doc/ ./gh-pages/doc/ | ||
cp ${{ env.revision }}/PackageInfo.g ./gh-pages/PackageInfo.g | ||
cp ${{ env.revision }}/README.md ./gh-pages/README.md | ||
rm -fv ./gh-pages/doc/.gitignore | ||
- name: gap -- run update.g | ||
working-directory: ./gh-pages | ||
run: | | ||
gap update.g | ||
- name: git -- commit the update | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: '[${{ github.ref_name }}] - website update' | ||
repository: gh-pages | ||
branch: gh-pages | ||
push_options: '--force' |