Equicord/.github/workflows/uploadBuilds.yml

81 lines
2.7 KiB
YAML
Raw Normal View History

2024-11-01 01:02:07 -04:00
name: Upload Builds
on:
2024-11-01 11:19:24 -04:00
workflow_dispatch:
2024-11-01 01:02:07 -04:00
workflow_run:
2024-11-01 11:19:24 -04:00
workflows: [Release Stable, Release Dev]
2024-11-01 01:02:07 -04:00
types: [completed]
2024-11-01 11:19:24 -04:00
schedule:
- cron: 0 0 * * *
2024-11-01 01:02:07 -04:00
env:
FORCE_COLOR: true
REPO: Equicord/Builds
TOKEN: ${{ secrets.ETOKEN }}
USERNAME: GitHub-Actions
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions: write-all
jobs:
Upload:
name: Upload Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Actions User
run: |
git config --global user.name "GitHub-Actions"
git config --global user.email actions@github.com
- name: Download build artifact from triggered workflow
2024-11-01 11:19:24 -04:00
if: ${{ github.event.workflow_run.head_branch == 'main' }}
2024-11-01 01:02:07 -04:00
uses: dawidd6/action-download-artifact@v2
with:
run_id: ${{ github.event.workflow_run.id }}
2024-11-01 11:19:24 -04:00
name: buildStable
2024-11-01 01:02:07 -04:00
path: ./release
search_artifacts: true
2024-11-01 11:19:24 -04:00
- name: Download build artifact from triggered workflow
if: ${{ github.event.workflow_run.head_branch == 'dev' }}
uses: dawidd6/action-download-artifact@v2
with:
run_id: ${{ github.event.workflow_run.id }}
name: buildDev
path: ./${{ github.event.workflow_run.event }}
search_artifacts: true
- name: Get time
id: time
run: |
cd release
echo "TIME=$(cat time.txt)" >> $GITHUB_ENV
2024-11-01 01:02:07 -04:00
- name: Upload Stable Build to Builds repo
if: ${{ github.event.workflow_run.head_branch == 'main' }}
run: |
git clone https://$USERNAME:$TOKEN@github.com/$REPO.git builds
cd builds
2024-11-01 11:19:24 -04:00
mkdir -p stable/$TIME
cp -r ../release/* ./stable/$TIME
2024-11-01 01:02:07 -04:00
git add -A
git commit -m "Stable Build for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
git push --force https://$USERNAME:$TOKEN@github.com/$REPO.git
- name: Upload Dev Build To Builds Repo
if: ${{ github.event.workflow_run.head_branch == 'dev' }}
run: |
git clone https://$USERNAME:$TOKEN@github.com/$REPO.git builds
cd builds
2024-11-01 11:19:24 -04:00
mkdir -p devbuilds/$TIME
cp -r ../release/* ./devbuilds/$TIME
2024-11-01 01:02:07 -04:00
git add -A
git commit -m "Dev Build for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
git push --force https://$USERNAME:$TOKEN@github.com/$REPO.git