naiveproxy #797
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: naiveproxy | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 21 * * *" | |
push: | |
branches: | |
- master | |
paths: | |
- naiveproxy/** | |
- .github/workflows/naiveproxy.yml | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get latest release | |
id: latest-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPO: klzgrad/naiveproxy | |
run: | |
echo "TAG=$(gh api /repos/${{env.REPO}}/releases/latest --jq .tag_name)" >> $GITHUB_OUTPUT | |
- name: Print release version | |
run: | | |
echo "${{ steps.latest-release.outputs.TAG }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@master | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@master | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@master | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.PAT }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@master | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@master | |
env: | |
CONTEXT: ${{ github.workflow }} | |
VERSION: ${{ steps.latest-release.outputs.TAG }} | |
with: | |
context: ./${{ env.CONTEXT}} | |
file: ./${{ env.CONTEXT }}/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
build-args: VERSION=${{ env.VERSION }} | |
tags: | | |
ghcr.io/zydou/${{ github.workflow }}:${{ env.VERSION }} | |
ghcr.io/zydou/${{ github.workflow }}:latest | |
zydou/${{ github.workflow }}:${{ env.VERSION }} | |
zydou/${{ github.workflow }}:latest | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@main | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.PAT }} | |
repository: ${{ github.repository_owner }}/${{ github.workflow }} | |
short-description: "Minimal naiveproxy client. (only 5MB)" | |
readme-filepath: ${{ github.workflow }}/README.md | |
build-multi: | |
runs-on: ubuntu-latest | |
needs: ["build"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Get latest release | |
id: latest-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPO: klzgrad/naiveproxy | |
run: | |
echo "TAG=$(gh api /repos/${{env.REPO}}/releases/latest --jq .tag_name)" >> $GITHUB_OUTPUT | |
- name: Print release version | |
run: | | |
echo "${{ steps.latest-release.outputs.TAG }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@master | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@master | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@master | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.PAT }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@master | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v3 | |
env: | |
CONTEXT: ${{ github.workflow }} | |
VERSION: ${{ steps.latest-release.outputs.TAG }} | |
with: | |
context: ./${{ env.CONTEXT}} | |
file: ./${{ env.CONTEXT }}/multi.Dockerfile | |
platforms: linux/amd64 | |
push: ${{ github.event_name != 'pull_request' }} | |
build-args: VERSION=${{ env.VERSION }} | |
tags: | | |
ghcr.io/zydou/${{ github.workflow }}:multi-${{ env.VERSION }} | |
ghcr.io/zydou/${{ github.workflow }}:multi | |
zydou/${{ github.workflow }}:multi-${{ env.VERSION }} | |
zydou/${{ github.workflow }}:multi |