diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7f33fa5..f38a786 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -12,7 +12,6 @@ on: jobs: build: strategy: - # Default is true, cancels jobs for other platforms in the matrix if one fails fail-fast: false matrix: @@ -24,9 +23,11 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - name: Code Checkout + uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - name: Setup Go v${{ matrix.go }} + uses: actions/setup-go@v2 with: go-version: ${{ matrix.go }} @@ -64,22 +65,14 @@ jobs: SRC_PATH: github.com/pterodactyl/wings run: | go build -v -trimpath -ldflags="-s -w -X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_${{ matrix.goos }}_${{ matrix.goarch }} wings.go + upx build/wings_${{ matrix.goos }}_${{ matrix.goarch }} + chmod +x build/wings_${{ matrix.goos }}_${{ matrix.goarch }} - name: Test run: go test ./... - - name: Compress binary and make it executable - if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} - run: | - upx build/wings_${{ matrix.goos }}_${{ matrix.goarch }} && chmod +x build/wings_${{ matrix.goos }}_${{ matrix.goarch }} - - - uses: actions/upload-artifact@v2 - if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} - with: - name: wings_${{ matrix.goos }}_${{ matrix.goarch }} - path: build/wings_${{ matrix.goos }}_${{ matrix.goarch }} - - - uses: actions/upload-artifact@v2 + - name: Upload Artifact + uses: actions/upload-artifact@v2 if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} with: name: wings_${{ matrix.goos }}_${{ matrix.goarch }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 772162e..f6ff6d8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,30 +1,42 @@ -name: CodeQL Scanning +name: CodeQL + on: push: branches: - 'develop' + pull_request: + branches: + - 'develop' + + schedule: + - cron: '0 9 * * 4' + jobs: - CodeQL-Build: - runs-on: ubuntu-latest + analyze: + name: Analyze + runs-on: ubuntu-20.04 + + strategy: + fail-fast: false + matrix: + language: + - go + steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} + - name: Code Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 2 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - # Override language selection by uncommenting this and choosing your languages - with: - languages: go + - name: Checkout Head + run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 22b7d99..ed50d1d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,47 +1,55 @@ name: Publish Docker Image + on: push: branches: - 'develop' tags: - 'v*' + jobs: - push_to_registry: - name: Push Image to GitHub Packages - runs-on: ubuntu-latest - # Always run against a tag, even if the commit into the tag has [docker skip] - # within the commit message. + push: + name: Push + runs-on: ubuntu-20.04 + + # Always run against a tag, even if the commit into the tag has [docker skip] within the commit message. if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))" + steps: - - uses: actions/checkout@v2 - - uses: crazy-max/ghaction-docker-meta@v1 - id: docker_meta + - name: Code Checkout + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Install buildx + uses: docker/setup-buildx-action@v1 with: - images: ghcr.io/pterodactyl/wings - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - - uses: docker/login-action@v1 + version: v0.5.1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.REGISTRY_TOKEN }} + - name: Release Production Build uses: docker/build-push-action@v2 if: "!contains(github.ref, 'develop')" - env: - REF: ${{ github.ref }} with: - push: true build-args: | - VERSION=${REF:11} - tags: ${{ steps.docker_meta.outputs.tags }} + VERSION=${GITHUB_REF:11} labels: ${{ steps.docker_meta.outputs.labels }} + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + - name: Release Development Build uses: docker/build-push-action@v2 if: "contains(github.ref, 'develop')" with: - push: ${{ github.event_name != 'pull_request' }} build-args: | - VERSION=dev-${GIT_COMMIT:0:7} - tags: ${{ steps.docker_meta.outputs.tags }} + VERSION=dev-$(git rev-parse --short "$GITHUB_SHA"} labels: ${{ steps.docker_meta.outputs.labels }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ac22b06..8411439 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,18 +1,21 @@ name: Create Release + on: push: tags: - 'v*' + jobs: release: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - name: Code Checkout + uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '1.15.2' + go-version: '1.15.6' - name: Build env: