Chore: bump go mods (#288) #256
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: Publish Docker Image | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '*' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: xjasonlyu | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get Version | |
id: shell | |
run: | | |
echo "version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | |
- name: Build and Push (dev) | |
if: github.ref == 'refs/heads/main' | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 | |
tags: | | |
xjasonlyu/tun2socks:dev | |
ghcr.io/xjasonlyu/tun2socks:dev | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build and Push (latest) | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 | |
tags: | | |
xjasonlyu/tun2socks:latest | |
xjasonlyu/tun2socks:${{ steps.shell.outputs.version }} | |
ghcr.io/xjasonlyu/tun2socks:latest | |
ghcr.io/xjasonlyu/tun2socks:${{ steps.shell.outputs.version }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |