diff --git a/.github/actions/extract-build-artifact/action.yaml b/.github/actions/extract-build-artifact/action.yaml new file mode 100644 index 000000000..2f5fe835a --- /dev/null +++ b/.github/actions/extract-build-artifact/action.yaml @@ -0,0 +1,43 @@ +name: Extract Build Artifact +description: Extracts artifacts from an existing Docker image to be used for from source installation +inputs: + digest: + description: Digest of Docker image to use + required: true + architecture: + description: Name of architecture, will be used to create directories (e.g. amd64, arm64) + required: true + release-tag: + description: Tag of the release to which the artifact will be attached + required: true + repository: + description: Repository to which the release belongs, e.g. owner/repo + required: true + token: + description: GitHub token with permissions to upload release assets + required: true +runs: + using: "composite" + steps: + - name: Start docker container for ${{ inputs.architecture }} + run: | + docker run --name homarr \ + -e "SECRET_ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000" \ + --detach --rm ${{ inputs.digest }} + shell: bash + - name: Extract build from ${{ inputs.architecture }} container + run: | + docker exec homarr cp /etc/nginx/templates/nginx.conf /app && \ + docker exec homarr tar -czf extraction.tar.gz -C /app . && \ + mkdir -p ${{ runner.temp }}/extraction/${{ inputs.architecture }} && \ + docker cp homarr:/app/extraction.tar.gz ${{ runner.temp }}/extraction/${{ inputs.architecture }}/build-${{ inputs.architecture }}.tar.gz + shell: bash + - name: Stop ${{ inputs.architecture }} container + if: always() + run: docker container remove --force --volumes homarr + shell: bash + - name: Add build archive to release + env: + GH_TOKEN: ${{ inputs.token }} + run: gh release upload --repo ${{ inputs.repository }} ${{ inputs.release-tag }} ${{ runner.temp }}/extraction/${{ inputs.architecture }}/build-${{ inputs.architecture }}.tar.gz --clobber + shell: bash diff --git a/.github/workflows/deployment-docker-image.yml b/.github/workflows/deployment-docker-image.yml index d0479ae21..1f9f40f17 100644 --- a/.github/workflows/deployment-docker-image.yml +++ b/.github/workflows/deployment-docker-image.yml @@ -37,7 +37,7 @@ jobs: outputs: version: ${{ steps.read-semver.outputs.version || steps.version-fallback.outputs.version }} git_ref: ${{ steps.read-git-ref.outputs.ref || github.ref }} - + skipped: ${{ env.SKIP_RELEASE }} steps: - run: echo "Skipping release for workflow_dispatch event" if: env.SKIP_RELEASE == 'true' @@ -146,7 +146,6 @@ jobs: outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true env: SKIP_ENV_VALIDATION: true - build-arm64: name: Build docker image for arm64 needs: release @@ -185,10 +184,38 @@ jobs: outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true env: SKIP_ENV_VALIDATION: true + extract-asset-amd64: + name: Extract amd64 asset from docker image + needs: [release, build-amd64] + runs-on: ubuntu-latest + steps: + - name: Extract amd64 + if: needs.release.outputs.skipped == 'false' + uses: homarr-labs/homarr/.github/actions/extract-build-artifact@dev + with: + digest: "${{ env.GHCR_REPO }}@${{ needs.build-amd64.outputs.digest }}" + architecture: amd64 + release-tag: ${{ needs.release.outputs.version }} + token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + extract-asset-arm64: + name: Extract arm64 asset from docker image + needs: [release, build-arm64] + runs-on: ubuntu-24.04-arm + steps: + - name: Extract arm64 + if: needs.release.outputs.skipped == 'false' + uses: homarr-labs/homarr/.github/actions/extract-build-artifact@dev + with: + digest: "${{ env.GHCR_REPO }}@${{ needs.build-arm64.outputs.digest }}" + architecture: arm64 + release-tag: ${{ needs.release.outputs.version }} + token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} publish: name: Complete deployment and notify - needs: [release, build-amd64, build-arm64] + needs: [release, build-amd64, build-arm64, extract-asset-amd64, extract-asset-arm64] runs-on: ubuntu-latest env: NEXT_VERSION: ${{ needs.release.outputs.version }} @@ -222,6 +249,13 @@ jobs: ${{ env.GHCR_REPO }}@${{ needs.build-amd64.outputs.digest }} \ ${{ env.GHCR_REPO }}@${{ needs.build-arm64.outputs.digest }} + - name: Publish release + if: needs.release.outputs.skipped == 'false' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release edit --repo ${{ github.repository }} ${{ needs.release.outputs.version }} --draft=false + - name: Discord notification env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/.releaserc.json b/.releaserc.json index e2414a583..0f2b07b43 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -44,6 +44,7 @@ { "successComment": false, "failComment": false, + "draftRelease": true, "releaseBodyTemplate": "<%= _.truncate(nextRelease.notes, { 'length': 124000, 'omission': '' }) %>" } ]