-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (69 loc) · 2.48 KB
/
main.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
79
80
81
82
83
84
85
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
- "yannic-tag-main"
env:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPAL_RPC_CREDENTIALS: ${{ secrets.OPAL_RPC_CREDENTIALS }}
jobs:
# check:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build
# run: bazel build //...
publish:
runs-on: ubuntu-latest
# needs:
# - "check"
if: github.ref == 'refs/heads/yannic-tag-main'
steps:
- uses: actions/checkout@v4
- name: Create tag
id: "tag"
env:
GIT_AUTHOR_NAME: "EngFlow"
GIT_AUTHOR_EMAIL: "[email protected]"
GIT_COMMITTER_NAME: "EngFlow"
GIT_COMMITTER_EMAIL: "[email protected]"
run: |
VERSION="$(date -u '+%Y.%m.%d-%H.%M.%S')"
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
# 1. Download `buildozer`
curl -o "${RUNNER_TEMP}/buildozer" -L "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildozer-linux-amd64"
chmod +x "${RUNNER_TEMP}/buildozer"
# 2. Update `MODULE.bazel` and commit.
"${RUNNER_TEMP}/buildozer" "set version ${VERSION}" "//MODULE.bazel:engflowapis"
git add "MODULE.bazel"
git commit -m "Release ${VERSION}"
# 3. Push release tag.
git tag "${VERSION}" "HEAD"
git push origin "${VERSION}"
# 4. Create release tarball
git archive -o "${RUNNER_TEMP}/archive.tar.gz" "${VERSION}"
- name: Create GitHub Release
id: "create-release"
uses: actions/create-release@v1
with:
tag_name: ${{ steps.tag.outputs.version }}
release_name: Release ${{ steps.tag.outputs.version }}
body: |
# EngFlow APIs ${{ steps.tag.outputs.version }}
To use this module, please add the following to `MODULE.bazel`:
```starlark
bazel_dep(name = "engflowapis", version = "${{ steps.tag.outputs.version }}")
```
prerelease: true
- name: Upload Tarball
id: upload-release-asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ runner.temp }}/archive.tar.gz
asset_name: engflowapis-${{ steps.tag.outputs.version }}.tar.gz
asset_content_type: "application/gzip"