-
Notifications
You must be signed in to change notification settings - Fork 1
173 lines (148 loc) · 5.81 KB
/
main.yaml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Build, Package, Release
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/[email protected]
with:
go-version: "1.21"
- name: Checkout repository
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.MO_CLI_TOKEN }}
# - name: Create Sematic Release Version
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "dns-manager"
# git config --global credential.helper cache
# npx standard-version
# git push --follow-tags origin main
# - name: release-please
# uses: googleapis/release-please-action@v4
# with:
# # this assumes that you have created a personal access token
# # (PAT) and configured it as a GitHub action secret named
# # `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
# token: ${{ secrets.MO_CLI_TOKEN }}
# # this is a built-in strategy in release-please, see "Action Inputs"
# # for more options
# release-type: simple
# target-branch: ${{ github.ref_name }}
# - name: Get the current version
# id: get_version
# run: echo "VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
# - name: release-please
# uses: googleapis/release-please-action@v4
# id: release
# with:
# token: ${{ secrets.MO_CLI_TOKEN }}
# release-type: simple
# target-branch: ${{ github.ref_name }}
# - name: Fetch latest tags
# run: git fetch --tags
# - name: Get latest version tag
# id: get_tag
# # run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
# run: echo "tag=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
# - name: Install Node.js
# uses: actions/setup-node@v3
# with:
# node-version: "18"
# - name: Install dependencies
# run: npm install
# - name: Apply Changesets
# id: changesets
# run: |
# # Bump the version and commit the changes
# npx changeset version
# # Push the changes back to the repo
# git config user.name "github-actions[bot]"
# git config user.email "github-actions[bot]@users.noreply.github.com"
# git push --follow-tags origin ${{ github.ref_name }}
# - name: Extract new version
# id: get_version
# run: echo "tag=$(node -p \"require('./package.json').version\")" >> $GITHUB_ENV
- name: Get latest tag
id: get_tag
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Bump version
id: bump_version
run: |
version=${tag/v/} # Entfernt das 'v' vor der Version
IFS='.' read -r major minor patch <<< "$version"
patch=$((patch + 1)) # Erhöht die Patch-Version
new_version="v${major}.${minor}.${patch}"
echo "new_version=$new_version" >> $GITHUB_ENV
- name: Create new tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ env.new_version }}
git push origin ${{ env.new_version }}
- name: Create release in another repo
run: |
gh release create ${{ env.new_version }} --title "Release ${{ env.new_version }}" --repo ruedigerp/homebrew-dns-manager
env:
GH_TOKEN: ${{ secrets.MO_CLI_TOKEN }}
# - name: Create release in another repo
# run: |
# echo "Creating release ${tag}"
# gh release create refs/tags/${tag} --title "Release ${tag}" --repo ruedigerp/homebrew-dns-manager
# env:
# GH_TOKEN: ${{ secrets.MO_CLI_TOKEN }}
- name: Initialize Go dependencies
run: go mod tidy
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Execute make all
run: make all
- name: Package artefacts
run: |
for file in builds/*; do
tar -czvf builds/$(basename "$file").tar.gz -C builds $(basename "$file")
done
ls -lisa builds
- name: Upload tarballs/executable
run: |
ls -lisa builds
for tarball in builds/*.tar.gz; do
echo "Tarball: $tarball"
gh release upload "${{ env.new_version }}" "$tarball" --repo ruedigerp/homebrew-dns-manager
done
gh release upload "${{ env.new_version }}" "builds/dns-manager-${{ env.new_version }}-windows-amd64" --repo ruedigerp/homebrew-dns-manager
env:
GH_TOKEN: ${{ secrets.MO_CLI_TOKEN }}
- name: UPDATE BREW / SCOOP
run: |
./release.sh
git config --global user.email "[email protected]"
git config --global user.name "dns-manager"
git config --global credential.helper cache
git clone https://${{secrets.MO_CLI_TOKEN}}@github.com/ruedigerp/homebrew-dns-manager
cd homebrew-dns-manager
cp ../dns-manager.rb .
cp ../dns-manager.json .
cp ../CHANGELOG.md .
git add .
git commit -m " ${{ env.new_version }}"
git push
env:
GH_TOKEN: ${{ secrets.MO_CLI_TOKEN }}