From 88c24e1b5bab6b4cd7b472e6ef4eb46c2e1d525c Mon Sep 17 00:00:00 2001 From: Mirabellensaft Date: Wed, 14 Jun 2023 11:49:48 +0200 Subject: [PATCH 1/3] edit names --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd4020af..a7075206 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,10 +27,10 @@ jobs: - name: Assemble Artifacts run: | - mkdir -p ./output - mv ./training-slides/slides ./output/training-slides-presentation - mv ./training-slides/book ./output/training-slides-book - zip -r ./output.zip ./output + mkdir -p ./rust-training + mv ./training-slides/slides ./rust-training/training-slides-presentation + mv ./training-slides/book ./rust-training/training-slides-book + zip -r ./rust-training.zip ./rust-training - name: Upload Artifacts uses: actions/upload-artifact@v3 @@ -39,11 +39,11 @@ jobs: name: Artifacts if-no-files-found: error path: | - ./output + ./rust-training - name: Create and Upload Release if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/') id: create_release uses: ncipollo/release-action@v1 with: - artifacts: ./output.zip + artifacts: ./rust-training.zip From 464d86b61e2a92ace366a6df31919f6c21ab621a Mon Sep 17 00:00:00 2001 From: "Jonathan Pallant (Ferrous Systems)" Date: Wed, 12 Jul 2023 17:04:51 +0100 Subject: [PATCH 2/3] Name the artefact and release appropriately. --- .github/workflows/build.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7075206..3a95f4c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,13 +5,16 @@ on: pull_request: jobs: - deploy: + build: runs-on: ubuntu-20.04 concurrency: group: ${{ github.workflow }}-${{ github.ref }} steps: - uses: actions/checkout@v3 + - uses: gacts/github-slug@v1 + id: slug + - name: Install tools uses: taiki-e/install-action@v2 with: @@ -27,10 +30,12 @@ jobs: - name: Assemble Artifacts run: | - mkdir -p ./rust-training - mv ./training-slides/slides ./rust-training/training-slides-presentation - mv ./training-slides/book ./rust-training/training-slides-book - zip -r ./rust-training.zip ./rust-training + echo "Making ./rust-training-${{ steps.slug.outputs.version-semantic }}..." + mkdir -p ./rust-training-${{ steps.slug.outputs.version-semantic }} + mv ./training-slides/slides ./rust-training-${{ steps.slug.outputs.version-semantic }}/training-slides-presentation + mv ./training-slides/book ./rust-training-${{ steps.slug.outputs.version-semantic }}/training-slides-book + echo "Compressing ./rust-training-${{ steps.slug.outputs.version-semantic }}.zip..." + zip -r ./rust-training-${{ steps.slug.outputs.version-semantic }}.zip ./rust-training-${{ steps.slug.outputs.version-semantic }} - name: Upload Artifacts uses: actions/upload-artifact@v3 @@ -39,11 +44,11 @@ jobs: name: Artifacts if-no-files-found: error path: | - ./rust-training + ./rust-training-*/ - name: Create and Upload Release if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/') id: create_release uses: ncipollo/release-action@v1 with: - artifacts: ./rust-training.zip + artifacts: ./rust-training-${{ steps.slug.outputs.version-semantic }}.zip From f6b7470e633be241e4537c718241db702df2911e Mon Sep 17 00:00:00 2001 From: "Jonathan Pallant (Ferrous Systems)" Date: Thu, 13 Jul 2023 11:19:25 +0100 Subject: [PATCH 3/3] Remove third-party action. Uses bash written by Pietro instead. --- .github/workflows/build.yml | 23 +++++++++++++---------- describe.sh | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 10 deletions(-) create mode 100755 describe.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a95f4c1..f7438b99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,14 +12,17 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: gacts/github-slug@v1 - id: slug - - name: Install tools uses: taiki-e/install-action@v2 with: tool: mdslides@0.3,mdbook@0.4,mdbook-mermaid@0.12 + - name: Find slug name + run: | + slug=$(./describe.sh "${GITHUB_REF}") + echo "Building with slug '${slug}'" + echo "slug=${slug}" >> "${GITHUB_ENV}" + - name: Build book-and-slides run: | ./training-slides/build.sh @@ -30,12 +33,12 @@ jobs: - name: Assemble Artifacts run: | - echo "Making ./rust-training-${{ steps.slug.outputs.version-semantic }}..." - mkdir -p ./rust-training-${{ steps.slug.outputs.version-semantic }} - mv ./training-slides/slides ./rust-training-${{ steps.slug.outputs.version-semantic }}/training-slides-presentation - mv ./training-slides/book ./rust-training-${{ steps.slug.outputs.version-semantic }}/training-slides-book - echo "Compressing ./rust-training-${{ steps.slug.outputs.version-semantic }}.zip..." - zip -r ./rust-training-${{ steps.slug.outputs.version-semantic }}.zip ./rust-training-${{ steps.slug.outputs.version-semantic }} + echo "Making ./rust-training-${{ env.slug }}..." + mkdir -p ./rust-training-${{ env.slug }} + mv ./training-slides/slides ./rust-training-${{ env.slug }}/training-slides-presentation + mv ./training-slides/book ./rust-training-${{ env.slug }}/training-slides-book + echo "Compressing ./rust-training-${{ env.slug }}.zip..." + zip -r ./rust-training-${{ env.slug }}.zip ./rust-training-${{ env.slug }} - name: Upload Artifacts uses: actions/upload-artifact@v3 @@ -51,4 +54,4 @@ jobs: id: create_release uses: ncipollo/release-action@v1 with: - artifacts: ./rust-training-${{ steps.slug.outputs.version-semantic }}.zip + artifacts: ./rust-training-${{ env.slug }}.zip diff --git a/describe.sh b/describe.sh new file mode 100755 index 00000000..ed834dff --- /dev/null +++ b/describe.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -euo pipefail + +GIVEN_REF=$1 + +case "${GIVEN_REF}" in + refs/heads/*) + slug="$(git branch --show)-$(git rev-parse --short HEAD)" + ;; + refs/tags/*) + slug="$(echo "${GIVEN_REF}" | awk '{split($0,a,"/"); print a[3]}')" + ;; + refs/pull/*/merge) + slug="pr-$(echo "${GIVEN_REF}" | awk '{split($0,a,"/"); print a[3]}')-$(git rev-parse --short HEAD)" + ;; +esac + +echo "${slug}"