Dump assembly #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
run-name: Dump assembly | |
name: dump-asm | |
on: | |
push: | |
paths: [ "**" ] | |
pull_request: | |
env: | |
IMAGE_REPO: doldecomp/melee | |
jobs: | |
dump-asm: | |
if: false | |
name: Dump assembly | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY: ghcr.io | |
OUTPUT: ${{ github.workspace }}/output | |
steps: | |
- name: Get image name | |
env: | |
IMAGE_SUFFIX: dump-asm:latest | |
run: | | |
echo "IMAGE=$IMAGE_REPO/$IMAGE_SUFFIX" >> $GITHUB_ENV | |
- name: Checkout Melee repository | |
uses: actions/checkout@v3 | |
- name: Log into container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pull assembly dump image | |
run: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE }} | |
- name: Dump assembly | |
run: | | |
mkdir -p "${{ env.OUTPUT }}" | |
short_sha="$(echo "${{ github.sha }}" | cut -c 1-7)" | |
tree_url="${{ github.server_url }}/${{ github.repository }}/tree/${{ github.sha }}" | |
docker run --rm \ | |
--user "$(id -u):$(id -g)" \ | |
--volume "$PWD:/input:ro" \ | |
--volume "${{ env.OUTPUT }}:/output" \ | |
-e SHORT_SHA="$short_sha" \ | |
-e TREE_URL="$tree_url" \ | |
${{ env.REGISTRY }}/${{ env.IMAGE }} | |
- name: Upload dumped assembly | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dump | |
path: ${{ env.OUTPUT }} | |
if-no-files-found: error | |
push-dump: | |
name: Push dump | |
runs-on: ubuntu-latest | |
needs: dump-asm | |
if: github.ref_name == github.event.repository.default_branch | |
concurrency: | |
group: "dump" | |
cancel-in-progress: true | |
steps: | |
- name: Download dumped assembly | |
uses: actions/download-artifact@v3 | |
with: | |
name: dump | |
path: /tmp/output | |
- name: Checkout Melee repository | |
uses: actions/checkout@v4 | |
with: | |
ref: dump | |
- name: Push to dump branch | |
run: | | |
rsync -r --delete --exclude '.git' /tmp/output/ . | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit --allow-empty \ | |
--author "${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>" \ | |
-m "Dump of ${{ github.sha }}" | |
git push |