From a2c7b72c0de588583cc24f2972a3cc7438875991 Mon Sep 17 00:00:00 2001 From: Mike Nisbet Date: Mon, 4 Nov 2024 12:52:02 +0000 Subject: [PATCH] first pass publish action --- .github/workflows/publish.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..5a5b532f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,42 @@ +name: CI +on: + workflow_dispatch: + +jobs: + release: + name: release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: main + + - name: Calculate Tag + id: tag + run: | + TAG=$(jq -r '.version' package.json) + echo "TAG=$TAG" >> $GITHUB_ENV + if git rev-parse $TAG >/dev/null 2>&1; then + echo "TAG_EXISTS=true" >> $GITHUB_ENV + else + echo "TAG_EXISTS=false" >> $GITHUB_ENV + fi + + - name: Samples to Samples~ + run: | + if [[ -d "Samples" ]]; then + git mv Samples Samples~ + rm -f Samples.meta + git config --global user.name 'github-bot' + git config --global user.email 'github-bot@users.noreply.github.com' + git commit -am "fix: Samples => Samples~" + git push -u origin main + fi + + - name: Create Release + if: env.TAG_EXISTS == 'false' + run: | + git tag ${{ env.TAG }} main + git push origin --tags