From 001edb857ac61503bd9a990d1fa0b33bfd1adcb7 Mon Sep 17 00:00:00 2001 From: ctcpip Date: Tue, 26 Sep 2023 15:45:40 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20release=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 4 ++++ .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/release.yml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..692b05c6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# prevent all files from being included in release archives +* export-ignore +meetings export-ignore +scripts export-ignore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..f71491f4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: release + +on: + push: + branches: + - main + paths: + - meetings/** + +jobs: + build: + runs-on: ubuntu-latest + steps: + - id: files + name: get changed files + uses: jitterbit/get-changed-files@v1 + with: + format: 'json' + - run: | + readarray -t added_files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.added }}')" + + for added_file in "${added_files[@]}"; do + if [[ ${added_file} == meetings/* ]] + then + tag=$(echo "${added_file}" | grep -oP '(?<=meetings/)[^\./]+') + echo "tag=${tag}" >> "$GITHUB_ENV" # set GH env var so other action can access it + echo tag set to "${tag}" + break + fi + done + - name: checkout + uses: actions/checkout@v3 + - name: release + run: | + git fetch --depth=1 --tags + + if [[ $(git tag -l "${{env.tag}}") ]] + then + echo "release exists; skipping" + else + gh release create "${{env.tag}}" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}