From 92838250b5197355c6e098f8ed25fd874ca3d4e7 Mon Sep 17 00:00:00 2001 From: sevenautumns Date: Fri, 24 Feb 2023 18:22:56 +0100 Subject: [PATCH 1/2] Automatic Release --- .github/workflows/nix.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/nix.yaml b/.github/workflows/nix.yaml index 97c3336..2c0308e 100644 --- a/.github/workflows/nix.yaml +++ b/.github/workflows/nix.yaml @@ -57,6 +57,18 @@ jobs: with: name: ${{ matrix.derivation }}@${{ matrix.nix-system }} path: ${{ matrix.derivation }} + - name: Prepare Release + if: startsWith(github.ref, 'refs/tags/') && contains(matrix.derivation, 'static') + run: cp $(readlink --canonicalize -- result)/${{ matrix.derivation }} ./${{ matrix.derivation }}-${{ matrix.nix-system }} + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') && contains(matrix.derivation, 'static') + with: + files: | + ${{ matrix.derivation }}-${{ matrix.nix-system }} + rp + LICENSE-MIT + LICENSE-APACHE - name: Deploy PDF artifacts if: ${{ matrix.derivation == 'whitepaper' && github.ref == 'refs/heads/main' }} uses: peaceiris/actions-gh-pages@v3 From a9c13caeaacf643482999c71f65251429f728eda Mon Sep 17 00:00:00 2001 From: wucke13 Date: Fri, 24 Feb 2023 20:00:15 +0100 Subject: [PATCH 2/2] refine CI release setup --- .github/workflows/nix.yaml | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/nix.yaml b/.github/workflows/nix.yaml index 2c0308e..47e020b 100644 --- a/.github/workflows/nix.yaml +++ b/.github/workflows/nix.yaml @@ -31,42 +31,37 @@ jobs: - name: Generate gitHeadInfo.gin for the whitepaper if: ${{ matrix.derivation == 'whitepaper' }} run: ( cd papers && ./tex/gitinfo2.sh && git add gitHeadInfo.gin ) - - name: Build ${{ matrix.derivation }} + - name: Build ${{ matrix.derivation }}@${{ matrix.nix-system }} run: | # build the package nix build .#packages.${{ matrix.nix-system }}.${{ matrix.derivation }} --print-build-logs # copy over the results if [[ -f $(readlink --canonicalize result ) ]]; then - mkdir -- ${{ matrix.derivation }} + mkdir -- ${{ matrix.derivation }}-${{ matrix.nix-system }} fi - cp --recursive -- $(readlink --canonicalize -- result) ${{ matrix.derivation }} - chmod --recursive -- ug+rw ${{ matrix.derivation }} + cp --recursive -- $(readlink --canonicalize result) ${{ matrix.derivation }}-${{ matrix.nix-system }} + chmod --recursive ug+rw -- ${{ matrix.derivation }}-${{ matrix.nix-system }} # add version information - git rev-parse --abbrev-ref HEAD > ${{ matrix.derivation }}/git-version - git rev-parse HEAD > ${{ matrix.derivation }}/git-sha + git rev-parse --abbrev-ref HEAD > ${{ matrix.derivation }}-${{ matrix.nix-system }}/git-version + git rev-parse HEAD > ${{ matrix.derivation }}-${{ matrix.nix-system }}/git-sha # override the `rp` script to keep compatible with non-nix systems - if [[ -f ${{ matrix.derivation }}/bin/rp ]] - then - cp --force rp ${{ matrix.derivation }}/bin/ + if [[ -f ${{ matrix.derivation }}-${{ matrix.nix-system }}/bin/rp ]]; then + cp --force -- rp ${{ matrix.derivation }}-${{ matrix.nix-system }}/bin/ fi - name: Upload build results uses: actions/upload-artifact@v3 with: - name: ${{ matrix.derivation }}@${{ matrix.nix-system }} - path: ${{ matrix.derivation }} - - name: Prepare Release - if: startsWith(github.ref, 'refs/tags/') && contains(matrix.derivation, 'static') - run: cp $(readlink --canonicalize -- result)/${{ matrix.derivation }} ./${{ matrix.derivation }}-${{ matrix.nix-system }} + name: ${{ matrix.derivation }}-${{ matrix.nix-system }} + path: ${{ matrix.derivation }}-${{ matrix.nix-system }} - name: Release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') && contains(matrix.derivation, 'static') + if: github.ref_type == 'tag' && startsWith( github.ref_name, 'v') && contains(matrix.derivation, 'static') with: files: | ${{ matrix.derivation }}-${{ matrix.nix-system }} - rp LICENSE-MIT LICENSE-APACHE - name: Deploy PDF artifacts @@ -74,7 +69,7 @@ jobs: uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: whitepaper + publish_dir: ${{ matrix.derivation }}-${{ matrix.nix-system }} publish_branch: papers-pdf force_orphan: true checks: