mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-10-13 23:00:43 +08:00
ci: use change filters for workflows
This commit is contained in:
parent
a6aec58c62
commit
4d7fe4e473
13
.editorconfig
Normal file
13
.editorconfig
Normal file
@ -0,0 +1,13 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@ -8,7 +8,14 @@ permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
uses: ./.github/workflows/filter-changes.yml
|
||||
permissions:
|
||||
pull-requests: read
|
||||
contents: read
|
||||
build:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.ci == 'true' }} && github.repository == 'pagefaultgames/rogueserver'
|
||||
name: Build (${{ matrix.os_name }})
|
||||
env:
|
||||
GO_VERSION: 1.22
|
||||
@ -25,9 +32,9 @@ jobs:
|
||||
- os: windows-latest
|
||||
os_name: windows
|
||||
arch: amd64
|
||||
# TODO macos needs universal binary!
|
||||
# - os: macos-latest
|
||||
# os_name: macos
|
||||
# TODO macos needs universal binary!
|
||||
# - os: macos-latest
|
||||
# os_name: macos
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go ${{ env.GO_VERSION }}
|
||||
@ -43,7 +50,7 @@ jobs:
|
||||
version: latest
|
||||
args: --config .golangci.yml
|
||||
- name: Test
|
||||
run: go test -v
|
||||
run: go test -v ./...
|
||||
- name: Build
|
||||
run: go build -v
|
||||
- name: Upload artifact
|
||||
|
38
.github/workflows/filter-changes.yml
vendored
Normal file
38
.github/workflows/filter-changes.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: Path Filters
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# JOB to run change detection
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
# Required permissions
|
||||
permissions:
|
||||
pull-requests: read
|
||||
# Set job outputs to values from filter step
|
||||
outputs:
|
||||
ci: ${{ steps.filter.outputs.ci }}
|
||||
ghcr: ${{ steps.filter.outputs.ghcr }}
|
||||
steps:
|
||||
# For pull requests it's not necessary to checkout the code
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
common: &common
|
||||
- '**/*.go'
|
||||
- go.mod
|
||||
- go.sum
|
||||
ghcr:
|
||||
- *common
|
||||
- .dockerignore
|
||||
- Dockerfile
|
||||
- docker-compose.Development.yml
|
||||
ci:
|
||||
- *common
|
||||
- .golangci.yml
|
9
.github/workflows/ghcr.yml
vendored
9
.github/workflows/ghcr.yml
vendored
@ -10,9 +10,16 @@ permissions:
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
uses: ./.github/workflows/filter-changes.yml
|
||||
permissions:
|
||||
pull-requests: read
|
||||
contents: read
|
||||
|
||||
build:
|
||||
needs: changes
|
||||
name: Build and publish to GHCR
|
||||
if: github.repository == 'pagefaultgames/rogueserver'
|
||||
if: ${{ needs.changes.outputs.ghcr == 'true' }} && github.repository == 'pagefaultgames/rogueserver'
|
||||
env:
|
||||
GO_VERSION: 1.22
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -12,6 +12,7 @@ path = [
|
||||
"go.sum",
|
||||
"go.mod",
|
||||
".github/FUNDING.yml",
|
||||
"**/*.editorconfig",
|
||||
]
|
||||
SPDX-FileCopyrightText = "NONE"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user