haru/redmine_code_review

View on GitHub
.github/workflows/release.yml

Summary

Maintainability
Test Coverage
name: build_archive
on:
  push:
    branches-ignore:
      - '**'
    tags:
      - '**'
env:
  SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
  archive:
    runs-on: ubuntu-latest
    steps:
      - name: Set version
        id: version
        run: |
          REPOSITORY=$(echo ${{ github.repository }} | sed -e "s#.*/##")
          VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
          echo ::set-output name=version::$VERSION
          echo ::set-output name=filename::$REPOSITORY-$VERSION
          echo ::set-output name=plugin::$REPOSITORY
      - uses: actions/checkout@v4
      - name: Archive
        run: |
          cd ..; zip -r ${{ steps.version.outputs.filename }}.zip ${{ steps.version.outputs.plugin }}/ -x "*.git*"; mv ${{ steps.version.outputs.filename }}.zip ${{ steps.version.outputs.plugin }}/
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ steps.version.outputs.version }}
          release_name: ${{ steps.version.outputs.version }}
          body: ''
          draft: false
          prerelease: true
      - name: Upload Release Asset
        id: upload-release-asset 
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} 
          asset_path: ${{ steps.version.outputs.filename }}.zip
          asset_name: ${{ steps.version.outputs.filename }}.zip
          asset_content_type: application/zip