diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 37e17a0..636ce91 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,7 @@ jobs: - name: Build the application run: npm run build + - name: Check if release exists id: check_release run: | @@ -42,13 +43,25 @@ jobs: echo "Release already exists. Skipping release creation." echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV fi - + + - name: Create release + id: create_release + if: steps.check_release.outputs.RELEASE_ID == '' + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + - name: Upload main.js uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ steps.create_release.outputs.upload_url || steps.check_release.outputs.upload_url }} asset_path: main.js asset_name: main.js asset_content_type: application/javascript @@ -58,7 +71,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ steps.create_release.outputs.upload_url || steps.check_release.outputs.upload_url }} asset_path: manifest.json asset_name: manifest.json asset_content_type: application/json