-
Notifications
You must be signed in to change notification settings - Fork 241
78 lines (72 loc) · 2.33 KB
/
ci-dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: CI - Dev
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
# push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
test:
uses: ./.github/workflows/test.yml
# create a dev tag for every branch except master
tag_version:
if: ${{ github.ref_type == 'branch' && github.ref_name != 'master' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.next }}
tag: v${{ steps.version.outputs.next }}
steps:
- name: Debug
if: runner.debug == '1'
run: echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Get version number
id: version
run: |
echo "next=$(go run ./tools/version next)" >> "$GITHUB_OUTPUT"
- name: Print version number
run: |
echo "### Release Info :rocket:" >> $GITHUB_STEP_SUMMARY
echo "Version: ${{ steps.version.outputs.next }}" >> $GITHUB_STEP_SUMMARY
- name: Create tag
uses: actions/github-script@v7
env:
TAG_NAME: v${{ steps.version.outputs.next }}
with:
script: |
const { TAG_NAME } = process.env;
await github.rest.git.createTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: TAG_NAME,
message: TAG_NAME,
object: context.sha,
type: 'commit'
});
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${TAG_NAME}`,
sha: context.sha
});
github-token: ${{ secrets.FLYIO_BUILDBOT_GITHUB_TOKEN }}
# # we can remove this workflow_call once the release.yml workflow file is
# # merged into the default branch
# build_and_release:
# uses:
# ./.github/workflows/release.yml
# needs: tag_version
# secrets: inherit