Skip to content

Commit

Permalink
Remove third-party action.
Browse files Browse the repository at this point in the history
Uses bash written by Pietro instead.
  • Loading branch information
jonathanpallant committed Jul 13, 2023
1 parent 464d86b commit f6b7470
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
19 changes: 19 additions & 0 deletions describe.sh
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit f6b7470

Please sign in to comment.