-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ee7a7bc
Showing
16 changed files
with
1,491 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", | ||
"dictionaries": [ | ||
"project-words", | ||
"gaming-terms" | ||
], | ||
"dictionaryDefinitions": [ | ||
{ | ||
"addWords": true, | ||
"name": "project-words", | ||
"path": "./project-words.txt" | ||
} | ||
], | ||
"ignorePaths": [ | ||
"node_modules", | ||
"/project-words.txt" | ||
], | ||
"import": [ | ||
"@cspell/dict-bash/cspell-ext.json", | ||
"@cspell/dict-companies/cspell-ext.json", | ||
"@cspell/dict-data-science/cspell-ext.json", | ||
"@cspell/dict-de-de/cspell-ext.json", | ||
"@cspell/dict-docker/cspell-ext.json", | ||
"@cspell/dict-gaming-terms/cspell-ext.json", | ||
"@cspell/dict-git/cspell-ext.json", | ||
"@cspell/dict-k8s/cspell-ext.json", | ||
"@cspell/dict-powershell/cspell-ext.json", | ||
"@cspell/dict-software-terms/cspell-ext.json", | ||
"@cspell/dict-vim/cspell-ext.json", | ||
"@cspell/dict-win32/cspell-ext.json" | ||
], | ||
"version": "0.2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
name: Build Go Binaries | ||
on: | ||
schedule: | ||
- cron: '0 0/1 * * *' | ||
workflow_dispatch: | ||
env: | ||
SOFTWARE_NAME: "Tailscale" | ||
FILE_NAME: "tailscaled" | ||
REPO: "tailscale/tailscale" | ||
# TODO: If you have forked ot copied this code you need to change to your repository here. | ||
REPO_SMALL: "lwbt/ts_build_test" | ||
GIT_USER_NAME: "lwbt" | ||
GIT_USER_EMAIL: "[email protected]" | ||
jobs: | ||
check-versions: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
TAG: ${{ steps.tag.outputs.TAG }} | ||
TAG_SMALL: ${{ steps.tag_small.outputs.TAG_SMALL }} | ||
steps: | ||
- name: Get latest ${{ env.SOFTWARE_NAME }} tag | ||
id: tag | ||
run: | | ||
latest_tag=$( | ||
curl -s "https://api.github.com/repos/${{ env.REPO }}/releases/latest" \ | ||
| grep -oP '"tag_name": "\K(.*)(?=")' | ||
) | ||
echo "TAG=$latest_tag" >> "$GITHUB_OUTPUT" | ||
echo "Latest ${{ env.SOFTWARE_NAME }} Tag: $latest_tag" | ||
- name: Get latest ${{ env.SOFTWARE_NAME }} Small tag | ||
id: tag_small | ||
run: | | ||
latest_tag=$( | ||
curl -s "https://api.github.com/repos/${{ env.REPO_SMALL }}/releases/latest" \ | ||
| grep -oP '"tag_name": "\K(.*)(?=")' || echo "" | ||
) | ||
echo "TAG_SMALL=$latest_tag" >> "$GITHUB_OUTPUT" | ||
echo "Latest ${{ env.SOFTWARE_NAME }} Small Tag: $latest_tag" | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: check-versions | ||
if: needs.check-versions.outputs.TAG_SMALL != needs.check-versions.outputs.TAG | ||
env: | ||
TAG: ${{ needs.check-versions.outputs.TAG }} | ||
strategy: | ||
matrix: | ||
go-version: [stable] | ||
os: [linux] | ||
platform: [amd64, arm, arm64, mips] | ||
steps: | ||
- name: Checkout ${{ env.SOFTWARE_NAME }} Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.REPO }} | ||
ref: ${{ env.TAG }} | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Download Go modules | ||
run: go mod download | ||
- name: Cross-compile | ||
run: | | ||
GOOS=${{ matrix.os }} GOARCH=${{ matrix.platform }} ./build_dist.sh \ | ||
--extra-small --box \ | ||
-o "${{ env.FILE_NAME }}-${{ matrix.os }}-${{ matrix.platform }}" ./cmd/${{ env.FILE_NAME }} | ||
- name: Upload built binary | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.FILE_NAME }}-${{ matrix.os }}-${{ matrix.platform }} | ||
path: ./${{ env.FILE_NAME }}-${{ matrix.os }}-${{ matrix.platform }} | ||
publish: | ||
runs-on: ubuntu-latest | ||
needs: [check-versions, build] | ||
if: needs.check-versions.outputs.TAG_SMALL != needs.check-versions.outputs.TAG | ||
env: | ||
TAG: ${{ needs.check-versions.outputs.TAG }} | ||
steps: | ||
# NOTE: While UPX seems to be at least available on the Ubuntu Runner | ||
# images, we opt to use the most recent version here with the latest | ||
# fixes. | ||
- name: Get UPX latest version | ||
id: get-upx-version | ||
run: | | ||
echo "UPX_VERSION=$( | ||
curl -s https://api.github.com/repos/upx/upx/releases/latest \ | ||
| jq -r '.tag_name' \ | ||
| cut -c 2- | ||
)" >> "$GITHUB_ENV" | ||
- name: Download UPX | ||
run: | | ||
wget -q "https://github.com/upx/upx/releases/download/v${{ env.UPX_VERSION }}/upx-${{ env.UPX_VERSION }}-amd64_linux.tar.xz" | ||
tar --to-stdout -xf "upx-${{ env.UPX_VERSION }}-amd64_linux.tar.xz" \ | ||
"upx-${{ env.UPX_VERSION }}-amd64_linux/upx" > "${PWD}/upx" | ||
chmod -v +x "${PWD}/upx" | ||
- name: Download built binaries | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: ${{ env.FILE_NAME }}-* | ||
- name: Moving files | ||
run: | | ||
for dir in "${{ env.FILE_NAME }}-"*; do | ||
mv -v "${dir}" "${dir}.d" | ||
mv -v "${dir}.d/${{ env.FILE_NAME }}-"* . | ||
rmdir -v "${dir}.d" | ||
done | ||
chmod -v +x "${{ env.FILE_NAME }}-"* | ||
- name: Compress Binary with UPX | ||
run: | | ||
"${PWD}/upx" --lzma --best --no-progress "${{ env.FILE_NAME }}-"* | ||
- name: Create checksums | ||
run: | | ||
sha256sum "${{ env.FILE_NAME }}-"* > "checksums.txt" | ||
- name: Checkout ${{ env.SOFTWARE_NAME }} Small repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: tools | ||
- name: Create tag in ${{ env.SOFTWARE_NAME }} Small repository | ||
run: | | ||
cd tools | ||
if git rev-parse --quiet --verify "refs/tags/${{ env.TAG }}"; then | ||
echo "Tag already exists" | ||
exit 0 | ||
else | ||
echo "Tag does not exist, creating" | ||
git config --global user.email "${{ env.GIT_USER_EMAIL }}" | ||
git config --global user.name "${{ env.GIT_USER_NAME }}" | ||
git tag "${{ env.TAG }}" | ||
git push --tags | ||
fi | ||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: Small ${{ env.SOFTWARE_NAME }} ${{ env.TAG }} | ||
tag: ${{ env.TAG }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: false | ||
prerelease: false | ||
#allowupdates: true | ||
artifacts: | | ||
${{ env.FILE_NAME }}-* | ||
checksums.txt | ||
body: | | ||
Small ${{ env.SOFTWARE_NAME }} build ${{ env.TAG }} | ||
For a complete changelog go to https://github.com/${{ env.REPO }}/releases/tag/${{ env.TAG }} | ||
This release was created by: | ||
* Building a combined binary of `tailscale` and `tailscaled` | ||
* Using the build option `--extra-small` | ||
* Compressing the binary with UPX | ||
To use both programs, rename `tailscaled-OS-ARCH` to `tailscaled` and create a symbolic (`ln -sv tailscaled tailscale`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Build Go Binary | ||
on: | ||
schedule: | ||
- cron: '0 0/1 * * *' | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
REPO_TS: "tailscale/tailscale" | ||
# TODO: If you have forked ot copied this code you need to change to your repository here. | ||
REPO_SMALL_TS: "lwbt/ts_build_test" | ||
strategy: | ||
matrix: | ||
go-version: [stable] | ||
os: [linux] | ||
platform: [amd64, arm, arm64, mips] | ||
steps: | ||
- name: Get latest Tailscale tag | ||
run: | | ||
latest_tag=$(curl -s "https://api.github.com/repos/${{ env.REPO_TS }}/releases/latest" | grep -oP '"tag_name": "\K(.*)(?=")') | ||
echo "TAG=$latest_tag" >> $GITHUB_ENV | ||
echo "Latest Tailscale Tag: $latest_tag" | ||
- name: Get latest Tailscale Small tag | ||
run: | | ||
latest_tag=$(curl -s "https://api.github.com/repos/${{ env.REPO_SMALL_TS }}/releases/latest" | grep -oP '"tag_name": "\K(.*)(?=")' || echo "") | ||
echo "TAG_SMALL=$latest_tag" >> $GITHUB_ENV | ||
echo "Latest Tailscale Small Tag: $latest_tag" | ||
- name: Checkout Tailscale code | ||
if: env.TAG_SMALL != env.TAG | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: tailscale/tailscale | ||
ref: ${{ env.TAG }} | ||
- name: Checkout Tailscale Small code | ||
if: env.TAG_SMALL != env.TAG | ||
uses: actions/checkout@v4 | ||
with: | ||
path: tools | ||
- name: Setup Go | ||
if: env.TAG_SMALL != env.TAG | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Download Go modules | ||
if: env.TAG_SMALL != env.TAG | ||
run: go mod download | ||
- name: Cross-compile for ${{ matrix.platform }} | ||
if: env.TAG_SMALL != env.TAG | ||
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.platform }} ./build_dist.sh --extra-small --box -o tailscaled-${{ matrix.os }}-${{ matrix.platform }} ./cmd/tailscaled | ||
- name: Get UPX latest version | ||
if: env.TAG_SMALL != env.TAG | ||
id: get-upx-version | ||
run: | | ||
echo "UPX_VERSION=$(curl -s https://api.github.com/repos/upx/upx/releases/latest | jq -r '.tag_name' | cut -c 2-)" >> $GITHUB_ENV | ||
- name: Download UPX | ||
if: env.TAG_SMALL != env.TAG | ||
run: | | ||
wget -q "https://github.com/upx/upx/releases/download/v${{ env.UPX_VERSION }}/upx-${{ env.UPX_VERSION }}-amd64_linux.tar.xz" | ||
tar --to-stdout -xf "upx-${{ env.UPX_VERSION }}-amd64_linux.tar.xz" "upx-${{ env.UPX_VERSION }}-amd64_linux/upx" > "${PWD}/upx" | ||
chmod -v +x "${PWD}/upx" | ||
- name: Compress Binary with UPX | ||
if: env.TAG_SMALL != env.TAG | ||
run: | | ||
"${PWD}/upx" --lzma --best --no-progress "tailscaled-${{ matrix.os }}-${{ matrix.platform }}" | ||
sha256sum "tailscaled-${{ matrix.os }}-${{ matrix.platform }}" > "tailscaled-${{ matrix.os }}-${{ matrix.platform }}.sha256" | ||
- name: Create tag in Tailscale Small repository | ||
if: env.TAG_SMALL != env.TAG | ||
run: | | ||
cd tools | ||
if git rev-parse --quiet --verify "refs/tags/${{ env.TAG }}"; then | ||
echo "Tag already exists" | ||
exit 0 | ||
else | ||
echo "Tag does not exist, creating" | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "lwbt" | ||
git tag ${{ env.TAG }} | ||
git push --tags | ||
fi | ||
- name: Create Release | ||
if: env.TAG_SMALL != env.TAG | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: Small Tailscale ${{ env.TAG }} | ||
tag: ${{ env.TAG }} | ||
body: | | ||
Small Tailscale build ${{ env.TAG }} | ||
|
||
For a complete changelog go to https://github.com/${{ env.REPO_TS }}/releases/tag/${{ env.TAG }} | ||
|
||
This release was created by: | ||
|
||
* Building a combined binary of `tailscale` and `tailscaled` | ||
* Using the build option `--extra-small` | ||
* Compressing the binary with UPX | ||
|
||
To use both programs, rename `tailscaled-OS-ARCH` to `tailscaled` and create a symbolic (`ln -sv tailscaled tailscale`) | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: false | ||
prerelease: false | ||
allowupdates: true | ||
artifacts: | | ||
tailscaled-${{ matrix.os }}-${{ matrix.platform }} | ||
tailscaled-${{ matrix.os }}-${{ matrix.platform }}.sha256 |
Oops, something went wrong.