diff options
Diffstat (limited to '')
| -rw-r--r-- | .github/workflows/build.yaml | 4 | ||||
| -rw-r--r-- | .github/workflows/deploy.yaml | 4 | ||||
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | scripts/version.py | 3 | 
4 files changed, 9 insertions, 3 deletions
| diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e5791c9..c8d7a68 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,6 +21,9 @@ jobs:      steps:        - name: Checkout code          uses: actions/checkout@v2 +        with: +          # The version script relies on history. Fetch 100 commits to be safe. +          fetch-depth: 100        - name: Get version          id: version @@ -28,6 +31,7 @@ jobs:            set -eu            version=$(python scripts/version.py)            echo "::set-output name=version::version" +          printf "%s\n" "${version}"        # The current version (v2) of Docker's build-push action uses buildx,        # which comes with BuildKit. It has cache features which can speed up diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 9113188..82903f8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -36,9 +36,11 @@ jobs:            username: ${{ github.repository_owner }}            password: ${{ secrets.GITHUB_TOKEN  }} -      # The Dockerfile will be needed.        - name: Checkout code          uses: actions/checkout@v2 +        with: +          # The version script relies on history. Fetch 100 commits to be safe. +          fetch-depth: 100        # Build the final production image and push it to GHCR.        # Tag it with both the short commit SHA and 'latest'. @@ -75,7 +75,6 @@ All environment variables have defaults and are therefore not required to be set  Name | Description  ---- | -----------  `DEBUG` | Enable debug logging if set to a non-empty value. -`GIT_SHA` | [Sentry release] identifier. Set in CI.  `NSJAIL_CFG` | Path to the NsJail configuration file.  `NSJAIL_PATH` | Path to the NsJail binary.  `SNEKBOX_SENTRY_DSN` | [Data Source Name] for Sentry. Sentry is disabled if left unset. diff --git a/scripts/version.py b/scripts/version.py index bf8d509..62ff07e 100644 --- a/scripts/version.py +++ b/scripts/version.py @@ -31,7 +31,8 @@ def count_commits_on_date(dt: datetime.datetime) -> int:      args = ["git", "log", "--oneline", "--after", str(dt.timestamp())]      stdout = subprocess.check_output(args, text=True) -    return stdout.strip().count("\n") +    # The last newline is stripped, so it has to be manually counted with + 1. +    return stdout.strip().count("\n") + 1  if __name__ == "__main__": | 
