Build and publish angr docker image #10
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
name: Build and publish angr docker image | |
on: | |
schedule: | |
- cron: '0 19 * * 2' # angr releases at 0 17 * * 2 | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'angr version to build' | |
type: string | |
required: false | |
default: '' | |
push_version: | |
description: 'push the version to docker hub' | |
type: boolean | |
required: true | |
default: false | |
push_latest: | |
description: 'push the latest tag to docker hub' | |
type: boolean | |
required: true | |
default: false | |
jobs: | |
update: | |
name: Build and publish angr docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Get latest angr version | |
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.version == '' }} | |
run: | | |
pip install --user feedparser | |
ANGR_VERSION=$(python -c "import feedparser; print(feedparser.parse('https://pypi.org/rss/project/angr/releases.xml').entries[0].title)") | |
echo "ANGR_VERSION=$ANGR_VERSION" >> $GITHUB_ENV | |
- name: Set angr version | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }} | |
run: echo "ANGR_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
- name: Build angr docker image | |
run: | | |
docker build --build-arg ANGR_VERSION=$ANGR_VERSION -t angr/angr:$ANGR_VERSION . | |
docker tag angr/angr:$ANGR_VERSION angr/angr:latest | |
- name: Test angr docker image | |
run: docker run --rm angr/angr:$ANGR_VERSION /home/angr/.venv/bin/python -c "import angr; print(angr.__version__)" | |
- name: Login to docker hub | |
run: echo $DOCKER_PASSWORD | docker login -u angrbot --password-stdin | |
env: | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} | |
- name: Push versioned angr docker image | |
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.push_version }} | |
run: docker push angr/angr:$ANGR_VERSION | |
- name: Push latest angr docker image | |
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.push_latest }} | |
run: docker push angr/angr:latest |