Skip to content

Commit

Permalink
Merge pull request #82 from kozakura913/main
Browse files Browse the repository at this point in the history
Releasesにバイナリをアップロードする
  • Loading branch information
kozakura913 authored Dec 29, 2024
2 parents 004888d + 2b7513a commit 0824da2
Showing 1 changed file with 69 additions and 1 deletion.
70 changes: 69 additions & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
platforms: ${{ matrix.platform }}
Expand All @@ -103,6 +103,16 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=min

- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
context: .
platforms: ${{ matrix.platform }}
load: true
tags: ${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=min

- name: Export digest
run: |
mkdir -p /tmp/digests
Expand All @@ -115,6 +125,64 @@ jobs:
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

- name: Extract Application
run: |
mkdir /tmp/app/
chmod o+rwx /tmp/app/
docker run --rm -t -v /tmp/app:/tmp/app ${{ github.repository }}:latest cp /media-proxy-rs/media-proxy-rs /tmp/app/
- name: Upload Application
uses: actions/upload-artifact@v4
with:
name: media-proxy-rs_${{ env.PLATFORM_PAIR }}
path: /tmp/app/media-proxy-rs
if-no-files-found: error
retention-days: 1

release:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
permissions:
contents: write
id-token: write
needs:
- build
strategy:
fail-fast: false
matrix:
platform:
- linux/386
- linux/amd64
- linux/arm64
- linux/arm/v6
- linux/arm/v7
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Download Application
uses: actions/download-artifact@v4
with:
path: /tmp/app
pattern: media-proxy-rs_${{ env.PLATFORM_PAIR }}
merge-multiple: true
- name: gzip Application
working-directory: /tmp/app
run: |
gzip -k media-proxy-rs
- name: Upload release
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/98575220/assets{?name,label} # find out this value by opening https://api.github.com/repos/<owner>/<repo>/releases in your browser and copy the full "upload_url" value including the {?name,label} part
release_id: 98575220 # same as above (id can just be taken out the upload_url, it's used to find old releases)
asset_path: /tmp/app/media-proxy-rs.gz # path to archive to upload
asset_name: media-proxy-rs_${{ env.PLATFORM_PAIR }}.gz # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
asset_content_type: application/gzip # required by GitHub API
max_releases: 7 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
ignore_hash: true

merge:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
Expand Down

0 comments on commit 0824da2

Please sign in to comment.