Skip to content

Commit

Permalink
添加 pwn/ROP workflows 文件
Browse files Browse the repository at this point in the history
  • Loading branch information
pn1fg committed Oct 15, 2023
1 parent 7f968ee commit c6839c5
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/chal.pwn.ROP.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Challenge ROP

on:
push:
branches: ["main"]
paths:
- "!**/README.md"
- "challenges/pwn/ROP/build/**"
workflow_dispatch:

env:
TYPE: pwn
NAME: ROP
REGISTRY: ghcr.io

jobs:
challenge-build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Compile
run: |
cd challenges/${{ env.TYPE }}/${{ env.NAME }}/build
gcc pwn.c -o pwn -no-pie -fno-stack-protector
mkdir -p ../attachments
cp -f pwn ../attachments/
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.NAME }}
tags: |
latest
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: challenges/${{ env.TYPE }}/${{ env.NAME }}/build
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

- name: Commit compiled file
run: |
git config --local user.email "145646018+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add challenges/${{ env.TYPE }}/${{ env.NAME }}/attachments/pwn
git commit --allow-empty -m "Add compiled file"
- name: Pull changes
run: |
git pull --rebase
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Re-pull on failure
if: ${{ failure() }}
run: git pull --rebase
- name: Re-push on failure
if: ${{ failure() }}
uses: ad-m/github-push-action@master
with:
force: true
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}

0 comments on commit c6839c5

Please sign in to comment.