feat: release workflow
This commit is contained in:
parent
e857a14fd7
commit
81855d079f
36
.github/workflows/release.yml
vendored
Normal file
36
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: Release Workflow
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Nix
|
||||||
|
uses: cachix/install-nix-action@v31
|
||||||
|
with:
|
||||||
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: ts-build
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
uses: googleapis/release-please-action@v4
|
||||||
|
id: release
|
||||||
|
with:
|
||||||
|
release-type: simple
|
||||||
|
|
||||||
|
- name: Upload release artifacts
|
||||||
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: gh release upload ${{ steps.release.outputs.tag_name }} ./build/.
|
47
flake.nix
47
flake.nix
@ -150,26 +150,21 @@
|
|||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
git_root=$(git rev-parse --show-toplevel)
|
git_root=$(git rev-parse --show-toplevel)
|
||||||
|
next_version=$(echo "${version}" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
||||||
version=$(git describe --abbrev=0)
|
|
||||||
version_no_v="''${version:1}"
|
|
||||||
|
|
||||||
next_version=$(echo "''${version}" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
|
||||||
next_version_no_v=$(echo "''${version_no_v}" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
|
||||||
|
|
||||||
cd "''${git_root}/client"
|
cd "''${git_root}/client"
|
||||||
npm version "''${next_version_no_v}"
|
npm version "''${next_version}"
|
||||||
git add package-lock.json
|
git add package-lock.json
|
||||||
git add package.json
|
git add package.json
|
||||||
|
|
||||||
cd "''${git_root}"
|
cd "''${git_root}"
|
||||||
nix-update --flake --version "''${next_version_no_v}" --subpackage client default
|
nix-update --flake --version "''${next_version}" --subpackage client default
|
||||||
git add flake.nix
|
git add flake.nix
|
||||||
git commit -m "bump: ''${version} -> ''${next_version}"
|
git commit -m "bump: ${version} -> ''${next_version}"
|
||||||
git push origin main
|
git push origin main
|
||||||
|
|
||||||
git tag -a "''${next_version}" -m "bump: ''${version} -> ''${next_version}"
|
git tag -a "v''${next_version}" -m "bump: ${version} -> ''${next_version}"
|
||||||
git push origin "''${next_version}"
|
git push origin "v''${next_version}"
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -187,6 +182,33 @@
|
|||||||
revive -config revive.toml -formatter friendly ./...
|
revive -config revive.toml -formatter friendly ./...
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(writeShellApplication {
|
||||||
|
name = "ts-build";
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
git_root=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
|
cd "''${git_root}"
|
||||||
|
echo "Building client"
|
||||||
|
nix build .#trevstack-client
|
||||||
|
cp -a result/. server/internal/handlers/client/client
|
||||||
|
chmod -R u+w server/internal/handlers/client/client
|
||||||
|
|
||||||
|
cd "''${git_root}/server"
|
||||||
|
echo "Building ${pname}-windows-amd64-${version}.exe"
|
||||||
|
GOOS=windows GOARCH=amd64 go build -o "../build/${pname}-windows-amd64-${version}.exe" .
|
||||||
|
|
||||||
|
echo "Building ${pname}-linux-amd64-${version}"
|
||||||
|
GOOS=linux GOARCH=amd64 go build -o "../build/${pname}-linux-amd64-${version}" .
|
||||||
|
|
||||||
|
echo "Building ${pname}-linux-amd64-${version}"
|
||||||
|
GOOS=linux GOARCH=arm64 go build -o "../build/${pname}-linux-arm64-${version}" .
|
||||||
|
|
||||||
|
echo "Building ${pname}-linux-arm-${version}"
|
||||||
|
GOOS=linux GOARCH=arm go build -o "../build/${pname}-linux-arm-${version}" .
|
||||||
|
'';
|
||||||
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -197,11 +219,14 @@
|
|||||||
inherit client pname version;
|
inherit client pname version;
|
||||||
src = gitignore.lib.gitignoreSource ./server;
|
src = gitignore.lib.gitignoreSource ./server;
|
||||||
vendorHash = "sha256-sANPwYLGwMcWyMR7Veho81aAMfIQpVzZS5Q9eveR8o8=";
|
vendorHash = "sha256-sANPwYLGwMcWyMR7Veho81aAMfIQpVzZS5Q9eveR8o8=";
|
||||||
|
env.CGO_ENABLED = 0;
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
cp -r ${client} internal/handlers/client/client
|
cp -r ${client} internal/handlers/client/client
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
trevstack-client = client;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user