name: Upload Builds on: workflow_dispatch: workflow_run: workflows: [Release Stable, Release Dev] types: [completed] schedule: - cron: 0 0 * * * 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 if: ${{ github.event.workflow_run.head_branch == 'main' }} uses: dawidd6/action-download-artifact@v2 with: run_id: ${{ github.event.workflow_run.id }} name: buildStable path: ./release search_artifacts: true - 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 - 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 mkdir -p stable/$TIME cp -r ../release/* ./stable/$TIME 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 mkdir -p devbuilds/$TIME cp -r ../release/* ./devbuilds/$TIME 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