Skip to content

Commit

Permalink
- pov me being classically stupid as always
Browse files Browse the repository at this point in the history
(Hopefully I just win in lotto and don't have to write code in production 😂)
  • Loading branch information
EchterAlsFake committed Aug 18, 2024
1 parent a3fb192 commit 23dc68a
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 497 deletions.
135 changes: 0 additions & 135 deletions .github/workflows/build_cli_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,138 +76,3 @@ jobs:
with:
name: PornFetch_Linux_CLI_x32
path: dist/PornFetch_Linux_CLI_x32

create-release:
needs: [build-pornfetch-cli-linux-64, build-pornfetch-cli-linux-32]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install gh CLI
run: |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y
- name: Download Linux x64 artifact
uses: actions/download-artifact@v2
with:
name: PornFetch_Linux_CLI_x64
path: ./artifacts

- name: Download Linux x32 artifact
uses: actions/download-artifact@v2
with:
name: PornFetch_Linux_CLI_x32
path: ./artifacts

- name: List artifacts directory
run: ls -R ./artifacts

- name: Get short SHA
id: vars
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV

- name: Verify PAT
run: |
curl -H "Authorization: token ${{ secrets.PAT }}" https://api.github.com/user
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Check if Release Exists
id: check_release
run: |
if gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} >/dev/null 2>&1; then
echo "RELEASE_EXISTS=true" >> $GITHUB_ENV
echo "::set-output name=release_exists::true"
else
echo "RELEASE_EXISTS=false" >> $GITHUB_ENV
echo "::set-output name=release_exists::false"
fi
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Calculate SHA512 for Linux x64
id: sha512_linux_x64
run: |
sha512sum ./artifacts/PornFetch_Linux_CLI_x64 | awk '{ print $1 }' > sha512_linux_x64.txt
echo "sha512_linux_x64=$(cat sha512_linux_x64.txt)" >> $GITHUB_ENV
- name: Calculate SHA512 for Linux x32
id: sha512_linux_x32
run: |
sha512sum ./artifacts/PornFetch_Linux_CLI_x32 | awk '{ print $1 }' > sha512_linux_x32.txt
echo "sha512_linux_x32=$(cat sha512_linux_x32.txt)" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
if: steps.check_release.outputs.release_exists == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
SHA512_LINUX_X64: ${{ env.sha512_linux_x64 }}
SHA512_LINUX_X32: ${{ env.sha512_linux_x32 }}
with:
tag_name: v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }}
release_name: Automated Release v${{ secrets.VERSION }}-${{ env.GITHUB_SHA_SHORT }}
body: |
This is an automated release generated by the CI/CD pipeline.
SHA512 Checksums:
- PornFetch_Linux_CLI_x64: ${{ env.SHA512_LINUX_X64 }}
- PornFetch_Linux_CLI_x32: ${{ env.SHA512_LINUX_X32 }}
draft: false
prerelease: true


- name: Get current release body
id: get_release_body
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --json body --jq .body > current_body.txt || echo "" > current_body.txt
- name: Append new SHA512 hash to release body
id: append_release_body
run: |
echo -e "$(cat current_body.txt)\n- PornFetch_Linux_CLI_x64: ${{ env.sha512_linux_x64 }}\n- PornFetch_Linux_CLI_x32: ${{ env.sha512_linux_x32 }}" > new_body.txt
- name: Update GitHub release
run: |
gh release edit v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --notes "$(cat new_body.txt)"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
shell: bash

- name: Get Release Upload URL
id: get_release_url
run: |
UPLOAD_URL=$(gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --json uploadUrl --jq .uploadUrl)
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
echo "::set-output name=upload_url::$UPLOAD_URL"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
shell: bash

- name: Upload Linux x64 artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
upload_url: ${{ steps.get_release_url.outputs.upload_url }}
asset_path: ./artifacts/PornFetch_Linux_CLI_x64
asset_name: PornFetch_Linux_CLI_x64
asset_content_type: application/gzip

- name: Upload Linux x32 artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
upload_url: ${{ steps.get_release_url.outputs.upload_url }}
asset_path: ./artifacts/PornFetch_Linux_CLI_x32
asset_name: PornFetch_Linux_CLI_x32
asset_content_type: application/gzip
133 changes: 0 additions & 133 deletions .github/workflows/build_cli_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,136 +60,3 @@ jobs:
with:
name: PornFetch_Windows_CLI_x32
path: dist/PornFetch_Windows_CLI_x32.exe

create-release:
needs: [build-pornfetch-cli-windows-x64, build-pornfetch-cli-windows-x32]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install gh CLI
run: |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y
- name: Download Windows x64 artifact
uses: actions/download-artifact@v2
with:
name: PornFetch_Windows_CLI_x64
path: ./artifacts

- name: Download Windows x32 artifact
uses: actions/download-artifact@v2
with:
name: PornFetch_Windows_CLI_x32
path: ./artifacts

- name: List artifacts directory
run: ls -R ./artifacts

- name: Get short SHA
id: vars
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV

- name: Verify PAT
run: |
curl -H "Authorization: token ${{ secrets.PAT }}" https://api.github.com/user
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Check if Release Exists
id: check_release
run: |
if gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} >/dev/null 2>&1; then
echo "RELEASE_EXISTS=true" >> $GITHUB_ENV
echo "::set-output name=release_exists::true"
else
echo "RELEASE_EXISTS=false" >> $GITHUB_ENV
echo "::set-output name=release_exists::false"
fi
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Calculate SHA512 for Windows x64
id: sha512_windows_x64
run: |
sha512sum ./artifacts/PornFetch_Windows_CLI_x64.exe | awk '{ print $1 }' > sha512_windows_x64.txt
echo "sha512_windows_x64=$(cat sha512_windows_x64.txt)" >> $GITHUB_ENV
- name: Calculate SHA512 for Windows x32
id: sha512_windows_x32
run: |
sha512sum ./artifacts/PornFetch_Windows_CLI_x32.exe | awk '{ print $1 }' > sha512_windows_x32.txt
echo "sha512_windows_x32=$(cat sha512_windows_x32.txt)" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
if: steps.check_release.outputs.release_exists == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
SHA512_WINDOWS_X64: ${{ env.sha512_windows_x64 }}
SHA512_WINDOWS_X32: ${{ env.sha512_windows_x32 }}

with:
tag_name: v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }}
release_name: Automated Release v${{ secrets.VERSION }}-${{ env.GITHUB_SHA_SHORT }}
body: |
This is an automated release generated by the CI/CD pipeline.
SHA512 Checksums:
- PornFetch_Windows_CLI_x64: ${{ env.SHA512_WINDOWS_X64 }}
- PornFetch_Windows_CLI_x32: ${{ env.SHA512_WINDOWS_X32 }}
draft: false
prerelease: true

- name: Get current release body
id: get_release_body
run: |
gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --json body --jq .body > current_body.txt || echo "" > current_body.txt
- name: Append new SHA512 hash to release body
id: append_release_body
run: |
echo -e "$(cat current_body.txt)\n- PornFetch_Windows_CLI_x64: ${{ env.sha512_windows_x64 }}\n- PornFetch_Windows_CLI_x32: ${{ env.sha512_windows_x32 }}" > new_body.txt
- name: Update GitHub release
run: |
gh release edit v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --notes "$(cat new_body.txt)"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
shell: bash

- name: Get Release Upload URL
id: get_release_url
run: |
UPLOAD_URL=$(gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --json uploadUrl --jq .uploadUrl)
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
echo "::set-output name=upload_url::$UPLOAD_URL"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
shell: bash

- name: Upload Windows x64 artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
upload_url: ${{ steps.get_release_url.outputs.upload_url }}
asset_path: ./artifacts/PornFetch_Windows_CLI_x64.exe
asset_name: PornFetch_Windows_CLI_x64.exe
asset_content_type: application/octet-stream

- name: Upload Windows x32 artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
upload_url: ${{ steps.get_release_url.outputs.upload_url }}
asset_path: ./artifacts/PornFetch_Windows_CLI_x32.exe
asset_name: PornFetch_Windows_CLI_x32.exe
asset_content_type: application/octet-stream
109 changes: 0 additions & 109 deletions .github/workflows/build_gui_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,112 +46,3 @@ jobs:
with:
name: pyside6-application-x64
path: deploy/main.bin

create-release:
needs: build-pornfetch-gui-linux-x64
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install gh CLI
run: |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh -y
- name: Download Linux x64 artifact
uses: actions/download-artifact@v2
with:
name: pyside6-application-x64
path: ./artifacts

- name: List artifacts directory
run: ls -R ./artifacts

- name: Get short SHA
id: vars
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV

- name: Verify PAT
run: |
curl -H "Authorization: token ${{ secrets.PAT }}" https://api.github.com/user
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Check if Release Exists
id: check_release
run: |
if gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} >/dev/null 2>&1; then
echo "RELEASE_EXISTS=true" >> $GITHUB_ENV
echo "::set-output name=release_exists::true"
else
echo "RELEASE_EXISTS=false" >> $GITHUB_ENV
echo "::set-output name=release_exists::false"
fi
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Calculate SHA512 for Linux x64
id: sha512_linux_x64
run: |
sha512sum ./artifacts/main.bin | awk '{ print $1 }' > sha512_linux_x64.txt
echo "sha512_linux_x64=$(cat sha512_linux_x64.txt)" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
if: steps.check_release.outputs.release_exists == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
SHA512_LINUX_X64: ${{ env.sha512_linux_x64 }}
with:
tag_name: v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }}
release_name: Automated Release v${{ secrets.VERSION }}-${{ env.GITHUB_SHA_SHORT }}
body: |
This is an automated release generated by the CI/CD pipeline.
SHA512 Checksums:
- PornFetch_Linux_GUI_x64: ${{ env.sha512_linux_x64 }}
draft: false
prerelease: true

- name: Get current release body
id: get_release_body
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --json body --jq .body > current_body.txt || echo "" > current_body.txt
- name: Append new SHA512 hash to release body
id: append_release_body
run: |
echo -e "$(cat current_body.txt)\n- PornFetch_GUI_Linux_x64: ${{ env.sha512_linux_x64 }}" > new_body.txt
- name: Update GitHub release
run: |
gh release edit v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --notes "$(cat new_body.txt)"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
shell: bash

- name: Get Release Upload URL
id: get_release_url
run: |
UPLOAD_URL=$(gh release view v${{ secrets.VERSION }}-automated-${{ env.GITHUB_SHA_SHORT }} --json uploadUrl --jq .uploadUrl)
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
echo "::set-output name=upload_url::$UPLOAD_URL"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
shell: bash

- name: Upload Linux x64 artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
upload_url: ${{ steps.get_release_url.outputs.upload_url }}
asset_path: ./artifacts/main.bin
asset_name: PornFetch_GUI_Linux_x64.bin
asset_content_type: application/octet-stream
Loading

0 comments on commit 23dc68a

Please sign in to comment.