Skip to content

Commit

Permalink
IDK
Browse files Browse the repository at this point in the history
  • Loading branch information
vexorian committed Nov 10, 2023
1 parent 5fa414a commit 26c48ab
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/releaa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Update Release Files on Branch Push

on:
push:
branches:
- 'docker-action'

env:
RELEASE: please-ignore
FILE_NAME: dizquetv-win-x64.exe

jobs:
update-release-files:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile-builder
push: false
tags: builder

- name: Run dist docker
run: |
docker run -v ./dist:/home/node/app/dist builder
- name: Get Release ID
id: get_release
run: |
RELEASE_ID=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.RELEASE }}" \
| jq -r '.id')
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
- name: Delete Old Asset (Optional)
run: |
ASSET_ID=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets" \
| jq -r '.[] | select(.name == "${{ env.FILE_NAME }}").id')
if [ "$ASSET_ID" != "" ]; then
curl -s \
-X DELETE \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/assets/$ASSET_ID"
fi
- name: Upload New Asset
uses: actions/upload-release-asset@v1
with:
upload_url: "https://uploads.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets"
asset_path: ./dist/${{ env.FILE_NAME }}
asset_name: ${{ env.FILE_NAME }}
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 26c48ab

Please sign in to comment.