From 43364b97b21b290de83f0820958ca4e2728a9c47 Mon Sep 17 00:00:00 2001 From: Daniel Underwood Date: Sat, 26 Feb 2022 12:53:11 -0500 Subject: [PATCH] Added: Docker build --- .github/workflows/go.yml | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..664c090 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,76 @@ +name: Go + +on: [push, pull_request] + +jobs: + CodeQL: + # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest + runs-on: ubuntu-latest + + permissions: + # required for all workflows + security-events: write + + # only required for workflows in private repositories + actions: read + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 + check: + name: "Check code and dependencies" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - uses: dominikh/staticcheck-action@v1.0.0 + with: + version: "2021.1.1" + - run: go vet ./... + + Docker-Publish: + runs-on: ubuntu-latest + needs: [CodeQL, check] + if: github.event_name == 'push' + + steps: + - uses: actions/checkout@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + install: true + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate image tag + run: | + export VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + echo VERSION=$VERSION >> $GITHUB_ENV + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: | + ghcr.io/danielunderwood/log2http:latest + ghcr.io/danielunderwood/log2http:${{ env.VERSION }} \ No newline at end of file