production #114
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
name: Deploy | |
on: deployment | |
permissions: | |
contents: read | |
jobs: | |
package: | |
if: github.event.deployment.environment == 'production' | |
name: Create package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
check-latest: true | |
go-version-file: 'go.mod' | |
- name: Compile gauge | |
run: go run build/make.go --all-platforms --skip-windows | |
- name: Create distro | |
run: | | |
go run build/make.go --distro --all-platforms --skip-windows | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gauge-non-windows-artifact | |
path: ./deploy | |
windows-package: | |
name: Create windows package | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
check-latest: true | |
go-version-file: 'go.mod' | |
- name: Prep installer generation | |
shell: powershell | |
run: | | |
Start-Sleep -Milliseconds 1 | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
Invoke-WebRequest "https://sourceforge.net/projects/nsis/files/NSIS%203/3.06.1/nsis-3.06.1-strlen_8192.zip/download" -UseBasicParsing -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome -Outfile "./nsis.zip" | |
Expand-Archive -Force -LiteralPath ./nsis.zip -DestinationPath "C:\Program Files (x86)\NSIS\" | |
- name: Compile gauge | |
run: | | |
go run build/make.go --verbose --all-platforms | |
Get-ChildItem -Recurse .\bin | |
- name: Create Distro | |
shell: pwsh | |
run: | | |
go run build/make.go --distro --bin-dir bin\windows_amd64 | |
go run build/make.go --distro --bin-dir bin\windows_386 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gauge-windows-artifact | |
path: ./deploy | |
gauge-version: | |
name: Upload gauge version | |
runs-on: ubuntu-latest | |
needs: [package, windows-package] | |
env: | |
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: gauge-non-windows-artifact | |
path: ./deploy | |
- name: fetch gauge version | |
run: | | |
cd deploy | |
version=$(ls gauge-*-linux.x86.zip | sed 's/gauge-//' | sed 's/-linux.*//') | |
if [ -z "$version" ]; then | |
echo "Gauge version is not set" | |
exit 1 | |
fi | |
echo $version > ../version.txt | |
- name: upload gauge version | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gauge-version | |
path: ./version.txt | |
github-release: | |
runs-on: ubuntu-latest | |
needs: [gauge-version] | |
env: | |
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: gauge-non-windows-artifact | |
path: ./deploy | |
- uses: actions/download-artifact@v4 | |
with: | |
name: gauge-windows-artifact | |
path: ./deploy | |
- name: Fetch gauge version | |
uses: actions/download-artifact@v4 | |
with: | |
name: gauge-version | |
path: . | |
- name: Set gauge version | |
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV | |
- name: update release note | |
run: | | |
echo "---------------------------" | |
echo "Creating release v$version" | |
echo "---------------------------" | |
cd deploy | |
echo -e "Gauge v$GAUGE_VERSION\n\n" > desc.txt | |
release_description=$(ruby -e "$(curl -sSfL https://github.com/getgauge/gauge/raw/master/build/create_release_text.rb)" getgauge gauge) | |
echo "$release_description" >> desc.txt | |
gh release create --title "Gauge v$GAUGE_VERSION" --notes-file ./desc.txt "v$GAUGE_VERSION" ./gauge-* | |
pypi-release: | |
runs-on: ubuntu-latest | |
needs: [gauge-version] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git fetch --prune --unshallow | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' # caching pip dependencies | |
- name: Fetch gauge version | |
uses: actions/download-artifact@v4 | |
with: | |
name: gauge-version | |
path: . | |
- name: Set gauge version | |
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV | |
- name: Deploy to pypi | |
env: | |
GAUGE_PACKAGE_NAME: getgauge-cli | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
cd build/pip | |
pip install -r requirements.txt | |
python build.py --dist | |
gauge_package=`ls dist/$GAUGE_PACKAGE_NAME-$GAUGE_VERSION.tar.gz` | |
python -m twine upload --non-interactive $gauge_package | |
npm-release: | |
runs-on: ubuntu-latest | |
needs: [gauge-version] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git fetch --prune --unshallow | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: 'build/npm/package-lock.json' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Fetch gauge version | |
uses: actions/download-artifact@v4 | |
with: | |
name: gauge-version | |
path: . | |
- name: Set gauge version | |
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV | |
- name: Setup Git User | |
run: | | |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)" | |
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)" | |
- name: Deploy npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
cd build/npm | |
npm version $GAUGE_VERSION | |
npm publish --access=public | |
choco-release: | |
runs-on: windows-latest | |
needs: [gauge-version, windows-package] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git fetch --prune --unshallow | |
- name: Fetch gauge version | |
uses: actions/download-artifact@v4 | |
with: | |
name: gauge-version | |
path: . | |
- uses: actions/download-artifact@v4 | |
with: | |
name: gauge-windows-artifact | |
path: ./deploy | |
- name: Set gauge version | |
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV | |
shell: bash | |
- name: Clone chocolatey-packages | |
run: | | |
git clone https://github.com/getgauge/chocolatey-packages | |
- name: Deploy to Gauge $GAUGE_VERSION to choco | |
shell: pwsh | |
env: | |
API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: | | |
cd chocolatey-packages | |
$Env:GAUGE_VERSION | Set-Content version | |
cd gauge | |
./package.ps1 | |
choco push "gauge.$Env:GAUGE_VERSION.nupkg" --apikey=$Env:API_KEY --source=https://push.chocolatey.org/ | |
brew-release: | |
runs-on: ubuntu-latest | |
needs: [gauge-version] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git fetch --prune --unshallow | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3 | |
- name: Fetch gauge version | |
uses: actions/download-artifact@v4 | |
with: | |
name: gauge-version | |
path: . | |
- name: Set gauge version | |
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV | |
- name: Update brew formula | |
env: | |
HOMEBREW_GITHUB_USER_NAME: ${{ secrets.HOMEBREW_GITHUB_USER_NAME }} | |
HOMEBREW_GITHUB_USER_EMAIL: ${{ secrets.HOMEBREW_GITHUB_USER_EMAIL }} | |
GITHUB_TOKEN: ${{ secrets.GAUGEBOT_GITHUB_TOKEN }} | |
run: | | |
cd build/brew | |
bash create_brew_pr.sh |