From a9a4887bc39aef00cb1bf7515dac70e99d023d81 Mon Sep 17 00:00:00 2001 From: kameffee Date: Mon, 10 Jan 2022 07:06:28 +0900 Subject: [PATCH] Add release.yml --- .github/workflows/release.yml | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2d948c5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + release: + name: release + runs-on: ubuntu-latest + env: + ROOT: Packages/AudioPlayer + steps: + - uses: actions/checkout@v2 + - name: Get package + id: package + run: | + echo "::set-output name=data::$(cat ${{ env.ROOT }}/package.json | tr -d '\n')" + + - name: Prepare + run: | + git subtree split -P "${{ env.ROOT }}" -b "${{ env.BRANCH }}" + git checkout "${{ env.BRANCH }}" + git mv Samples Samples~ + rm -f Samples.meta + env: + BRANCH: release-tmp + + - name: Push upm branch + run: | + git fetch + git reset --soft origin/upm + git checkout upm + git config --global user.name 'github-bot' + git config --global user.email 'github-bot@users.noreply.github.com' + git commit -am ${{ env.VERSION }} + git status + git push origin upm + env: + VERSION: "v${{ fromJson(steps.package.outputs.data).version }}" + + - name: Add Tag + run: | + git tag -f ${{ env.TAG }} + git push -f origin ${{ env.TAG }} + env: + TAG: ${{ fromJson(steps.package.outputs.data).version }} + + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: "v${{ fromJson(steps.package.outputs.data).version }}" + release_name: "v${{ fromJson(steps.package.outputs.data).version }}" + body: https://github.com/kameffee/AudioPlayer.git#${{ fromJson(steps.package.outputs.data).version }} + draft: false + prerelease: false