Skip to content

Dump assembly

Dump assembly #3

Workflow file for this run

run-name: Dump assembly
name: dump-asm
on:
push:
paths: [ "**" ]
pull_request:
jobs:
dump-asm:
name: Dump assembly
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
steps:
- name: Get image name
env:
EVENT_NAME: ${{ github.event_name }}
PUSH_REPO_NAME: ${{ github.repository }}
PR_REPO_NAME: ${{ github.event.repository.full_name }}
IMAGE_SUFFIX: dump-asm:latest
shell: bash
run: |
result=""
case "$EVENT_NAME" in
push)
result="$PUSH_REPO_NAME"
;;
pull_request)
result="$PR_REPO_NAME"
;;
esac
result=$(echo "$result/$IMAGE_SUFFIX" | tr '[:upper:]' '[:lower:]')
echo "IMAGE=$result" >> $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: |
short_sha="$(echo "${{ github.sha }}" | cut -c 1-7)"
tree_url="${{ github.server_url }}/${{ github.repository }}/tree/${{ github.sha }}"
docker run --rm \
--volume "$PWD:/input:ro" \
--volume /tmp/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: /tmp/output
push-dump:
name: Push dump
runs-on: ubuntu-latest
needs: dump-asm
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
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