Build Docker Images (Ubuntu LTS) #190
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 Docker Images (Ubuntu LTS) | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'build/ubuntu/lts/**' | |
- 'docker/**' | |
schedule: | |
- cron: '0 22 * * FRI' # 每周六 06:00 执行任务(CST = UTC + 8:00) | |
workflow_dispatch: | |
jobs: | |
init-build-env: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Get All Changed Files | |
id: step2 | |
run: | | |
git fetch --depth=2 | |
git diff --name-only "HEAD^" > /tmp/changed_files.txt | |
echo "changed_files=$(paste -sd "," /tmp/changed_files.txt)" >> "$GITHUB_OUTPUT" | |
cat /tmp/changed_files.txt | |
- name: Install Dependencies | |
run: bash ./setup.sh | |
- name: Compress Folder | |
run: zip -r /tmp/artifact.zip . -x ".git/*" | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: env-artifact | |
path: /tmp/artifact.zip | |
outputs: | |
changed-files: ${{ steps.step2.outputs.changed_files }} | |
build-ubuntu1604: | |
if: | | |
github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || | |
contains(needs.init-build-env.outputs.changed-files, 'ubuntu/lts/16.04') | |
runs-on: ubuntu-latest | |
needs: [init-build-env] | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: env-artifact | |
path: . | |
- name: Decompress Artifact | |
run: unzip artifact.zip -d . | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./build/ubuntu/lts/16.04/Dockerfile | |
push: true | |
tags: th3s/pwn-env:ubuntu-16.04 | |
build-ubuntu1804: | |
if: | | |
github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || | |
contains(needs.init-build-env.outputs.changed-files, 'ubuntu/lts/18.04') | |
runs-on: ubuntu-latest | |
needs: [init-build-env] | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: env-artifact | |
path: . | |
- name: Decompress Artifact | |
run: unzip artifact.zip -d . | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./build/ubuntu/lts/18.04/Dockerfile | |
push: true | |
tags: th3s/pwn-env:ubuntu-18.04 | |
build-ubuntu2004: | |
if: | | |
github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || | |
contains(needs.init-build-env.outputs.changed-files, 'ubuntu/lts/20.04') | |
runs-on: ubuntu-latest | |
needs: [init-build-env] | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: env-artifact | |
path: . | |
- name: Decompress Artifact | |
run: unzip artifact.zip -d . | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./build/ubuntu/lts/20.04/Dockerfile | |
push: true | |
tags: th3s/pwn-env:ubuntu-20.04 | |
build-ubuntu2204: | |
if: | | |
github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || | |
contains(needs.init-build-env.outputs.changed-files, 'ubuntu/lts/22.04') | |
runs-on: ubuntu-latest | |
needs: [init-build-env] | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: env-artifact | |
path: . | |
- name: Decompress Artifact | |
run: unzip artifact.zip -d . | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./build/ubuntu/lts/22.04/Dockerfile | |
push: true | |
tags: th3s/pwn-env:ubuntu-22.04 | |
build-ubuntu2404: | |
if: | | |
github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || | |
contains(needs.init-build-env.outputs.changed-files, 'ubuntu/lts/24.04') | |
runs-on: ubuntu-latest | |
needs: [init-build-env] | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: env-artifact | |
path: . | |
- name: Decompress Artifact | |
run: unzip artifact.zip -d . | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./build/ubuntu/lts/24.04/Dockerfile | |
push: true | |
tags: th3s/pwn-env:ubuntu-24.04 |