From 38c1822589e68c44cf2ceea8e7beab9472241b93 Mon Sep 17 00:00:00 2001 From: Mikhail Savin Date: Sun, 29 Sep 2024 22:41:57 +0300 Subject: [PATCH] Add release workflow --- .github/workflows/release.yaml | 75 ++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..8a5a5f5 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,75 @@ +name: Release + +"on": + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Version + id: version + run: | + echo "::set-output name=tag::$(git describe --exact-match --tags HEAD | head -n1)" + - name: Build + run: | + npm install + npm run test + npm run build + - name: Package + run: | + mkdir "${{ github.event.repository.name }}" + cp main.js styles.css README.md manifest.json "${{ github.event.repository.name }}" + zip -r "${{ github.event.repository.name }}.zip" "${{ github.event.repository.name }}" + - name: Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_PAT }} + VERSION: ${{ github.ref }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + - name: Upload .zip + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_PAT }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.event.repository.name }}.zip + asset_name: ${{ github.event.repository.name }}-${{steps.version.outputs.tag}}.zip + asset_content_type: application/zip + - name: Upload main.js + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_PAT }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./main.js + asset_name: main.js + asset_content_type: text/javascript + - name: Upload manifest.json + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_PAT }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: manifest.json + asset_name: manifest.json + asset_content_type: application/json + - name: Upload styles.css + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_PAT }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: styles.css + asset_name: styles.css + asset_content_type: text/css