Skip to content

Commit

Permalink
Add separate CI job for defining Docker tags (#4607)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi authored Oct 9, 2024
1 parent a4c259a commit 5107906
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:

- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
# no cache-key as we want to clean cache, not restore it

- name: Install Task
run: go generate -x
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,62 @@ env:
GOTOOLCHAIN: local

jobs:
define:
name: Define Docker tags
runs-on: ubuntu-22.04
timeout-minutes: 10

if: >
github.event_name != 'pull_request_target' ||
(
contains(github.event.pull_request.labels.*.name, 'trust') &&
!contains(github.event.pull_request.labels.*.name, 'not ready')
)
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 0 # for `git describe` to work
lfs: false # LFS is used only by website

# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout pull request code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 0 # for `git describe` to work
lfs: false # LFS is used only by website
ref: ${{ github.event.pull_request.head.sha }}

# for version.txt on push tags; see https://github.com/actions/checkout/issues/290
- name: Fetch annotated tags
run: |
git fetch --tags --force
git status
# for branch.txt on pull_request_target; the correct branch is already checked out on push / schedule
- name: Name branch
if: github.event_name == 'pull_request_target'
env:
BRANCH: ${{ github.head_ref }} # see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
run: git checkout -b $BRANCH

- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: packages-define

- name: Install Task
run: go generate -x
working-directory: tools

- name: Define Docker image names
id: tag
run: bin/definedockertag

build:
name: Build packages
runs-on: server
Expand Down Expand Up @@ -93,6 +149,8 @@ jobs:

- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: packages-build

- name: Install Task
run: go generate -x
Expand Down

0 comments on commit 5107906

Please sign in to comment.