diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86a3786..3cc3557 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -214,4 +214,91 @@ jobs: uses: actions/upload-artifact@v4 with: name: docker-image-latest - path: docker-image-latest.tar \ No newline at end of file + path: docker-image-latest.tar + + release: + runs-on: ubuntu-latest + needs: [build-windows-package, build-linux-package, build-docker-image] + env: + IMAGE_NAME: youtubeplaylistdownloader + steps: + - uses: actions/download-artifact@v4 + with: + name: windows-zip + - uses: actions/download-artifact@v4 + with: + name: linux-zip + - uses: actions/download-artifact@v4 + with: + name: docker-image + - uses: actions/download-artifact@v4 + with: + name: docker-image-latest + - name: Get version from tag + id: version + shell: bash + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION="${{ inputs.tag }}" + elif [ "${{ github.event_name }}" = "release" ]; then + VERSION="${{ github.event.release.tag_name }}" + else + VERSION="${{ github.ref_name }}" + fi + VERSION="${VERSION#v}" + echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Set docker image names + run: | + echo "RELEASE_IMAGE=ghcr.io/${GITHUB_ACTOR}/youtubeplaylistdownloader:${{ steps.version.outputs.version }}" >> $GITHUB_ENV + echo "LATEST_IMAGE=ghcr.io/${GITHUB_ACTOR}/youtubeplaylistdownloader:latest" >> $GITHUB_ENV + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Load and push Docker release image + run: | + docker load -i docker-image/docker-image.tar + docker push $RELEASE_IMAGE + - name: Load and push Docker latest image + run: | + docker load -i docker-image-latest/docker-image-latest.tar + docker push $LATEST_IMAGE + - name: Create GitHub 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 }} + draft: true + - name: Upload Windows release asset + uses: actions/upload-release-asset@v2 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: windows-zip/yt-playlist-windows-${{ steps.version.outputs.version }}.zip + asset_name: yt-playlist-windows-${{ steps.version.outputs.version }}.zip + asset_content_type: application/zip + - name: Upload Linux release asset + uses: actions/upload-release-asset@v2 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: linux-zip/yt-playlist-linux-${{ steps.version.outputs.version }}.tar.gz + asset_name: yt-playlist-linux-${{ steps.version.outputs.version }}.tar.gz + asset_content_type: application/gzip + - name: Upload Docker release tar + uses: actions/upload-release-asset@v2 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: docker-image/docker-image.tar + asset_name: docker-image-${{ steps.version.outputs.version }}.tar + asset_content_type: application/x-tar + - name: Upload Docker latest tar + uses: actions/upload-release-asset@v2 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: docker-image-latest/docker-image-latest.tar + asset_name: docker-image-latest.tar + asset_content_type: application/x-tar \ No newline at end of file