mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2024-04-21 12:21:34 +00:00
50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
paths-ignore:
|
|
- '**.md'
|
|
- 'docs'
|
|
name: docker-nightly-build
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout the code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Prepare
|
|
id: prepare
|
|
run: |
|
|
echo ::set-output name=docker_platforms::linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
|
echo ::set-output name=docker_image::${{ secrets.DOCKER_USERNAME }}/trojan-go
|
|
echo ::set-output name=ref::${{ github.sha }}
|
|
|
|
- name: Build and push docker image
|
|
run: |
|
|
docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
|
|
--output "type=image,push=true" \
|
|
--tag "${{ steps.prepare.outputs.docker_image }}:nightly" \
|
|
--build-arg REF=${{ steps.prepare.outputs.ref }} \
|
|
--file Dockerfile .
|
|
|
|
test:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Test docker image
|
|
run: |
|
|
docker run --rm --entrypoint /usr/local/bin/trojan-go ${{ secrets.DOCKER_USERNAME }}/trojan-go -version
|