github.com/getgauge/gauge@v1.6.9/.github/workflows/release.yml (about)

     1  name: Deploy
     2  
     3  on: deployment
     4  
     5  permissions:
     6    contents: read
     7  
     8  jobs:
     9    package:
    10      if: github.event.deployment.environment == 'production'
    11      name: Create package
    12      runs-on: ubuntu-latest
    13      steps:
    14        - uses: actions/checkout@v4
    15        - name: Set up Go
    16          uses: actions/setup-go@v5
    17          with:
    18            check-latest: true
    19            go-version-file: 'go.mod'
    20  
    21        - name: Compile gauge
    22          run: go run build/make.go --all-platforms  --skip-windows
    23  
    24        - name: Create distro
    25          run: |
    26            go run build/make.go --distro --all-platforms --skip-windows
    27  
    28        - name: Upload artifacts
    29          uses: actions/upload-artifact@v4
    30          with:
    31            name: gauge-non-windows-artifact
    32            path: ./deploy
    33  
    34    windows-package:
    35      name: Create windows package
    36      runs-on: windows-latest
    37      steps:
    38        - uses: actions/checkout@v4
    39        - name: Set up Go
    40          uses: actions/setup-go@v5
    41          with:
    42            check-latest: true
    43            go-version-file: 'go.mod'
    44  
    45        - name: Prep installer generation
    46          shell: powershell
    47          run: |
    48            Start-Sleep -Milliseconds 1
    49            Invoke-WebRequest "https://sourceforge.net/projects/nsis/files/NSIS%203/3.10/nsis-3.10-strlen_8192.zip/download" -UserAgent "PowerShell" -Outfile "./nsis.zip"
    50            Expand-Archive -Force -LiteralPath ./nsis.zip -DestinationPath "C:\Program Files (x86)\NSIS\"
    51  
    52        - name: Compile gauge
    53          run: |
    54            go run build/make.go --verbose --all-platforms
    55            Get-ChildItem -Recurse .\bin
    56  
    57        - name: Create Distro
    58          shell: pwsh
    59          run: |
    60            go run build/make.go --distro --bin-dir bin\windows_amd64
    61            go run build/make.go --distro --bin-dir bin\windows_386
    62  
    63        - name: Upload artifacts
    64          uses: actions/upload-artifact@v4
    65          with:
    66            name: gauge-windows-artifact
    67            path: ./deploy
    68    
    69    gauge-version:
    70      name: Upload gauge version
    71      runs-on: ubuntu-latest
    72      needs: [package, windows-package]
    73      env:
    74        GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'
    75      steps:
    76        - uses: actions/checkout@v4
    77  
    78        - uses: actions/download-artifact@v4
    79          with:
    80            name: gauge-non-windows-artifact
    81            path: ./deploy
    82        
    83        - name: fetch gauge version
    84          run: |
    85            cd deploy
    86            version=$(ls gauge-*-linux.x86.zip |  sed 's/gauge-//' | sed 's/-linux.*//')
    87            if [ -z "$version" ]; then
    88                echo "Gauge version is not set"
    89                exit 1
    90            fi
    91            echo $version > ../version.txt
    92        
    93        - name: upload gauge version
    94          uses: actions/upload-artifact@v4
    95          with:
    96            name: gauge-version
    97            path: ./version.txt
    98  
    99    github-release:
   100      runs-on: ubuntu-latest
   101      needs: [gauge-version]
   102      env:
   103        GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'
   104      steps:
   105        - uses: actions/checkout@v4
   106  
   107        - uses: actions/download-artifact@v4
   108          with:
   109            name: gauge-non-windows-artifact
   110            path: ./deploy
   111  
   112        - uses: actions/download-artifact@v4
   113          with:
   114            name: gauge-windows-artifact
   115            path: ./deploy
   116  
   117        - name: Fetch gauge version
   118          uses: actions/download-artifact@v4
   119          with:
   120            name: gauge-version
   121            path: .
   122  
   123        - name: Set gauge version
   124          run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
   125  
   126        - name: update release note
   127          run: |
   128            echo "---------------------------"
   129            echo "Creating release v$version"
   130            echo "---------------------------"
   131  
   132            cd deploy
   133            echo -e "Gauge v$GAUGE_VERSION\n\n" > desc.txt
   134            release_description=$(ruby -e "$(curl -sSfL https://github.com/getgauge/gauge/raw/master/build/create_release_text.rb)" getgauge gauge)
   135            echo "$release_description" >> desc.txt
   136            gh release create --title "Gauge v$GAUGE_VERSION" --notes-file ./desc.txt "v$GAUGE_VERSION" ./gauge-*
   137  
   138  
   139    pypi-release:
   140      runs-on: ubuntu-latest
   141      needs: [gauge-version]
   142      steps:
   143        - uses: actions/checkout@v4
   144        - run: git fetch --prune --unshallow
   145  
   146        - name: Set up Python
   147          uses: actions/setup-python@v5
   148          with:
   149            python-version: '3.12'
   150            cache: 'pip' # caching pip dependencies
   151  
   152        - name: Fetch gauge version
   153          uses: actions/download-artifact@v4
   154          with:
   155            name: gauge-version
   156            path: .
   157  
   158        - name: Set gauge version
   159          run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
   160  
   161        - name: Deploy to pypi
   162          env:
   163            GAUGE_PACKAGE_NAME: getgauge-cli
   164            TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
   165          run: |
   166            cd build/pip
   167            pip install -r requirements.txt
   168            python build.py --dist
   169            gauge_package=`ls dist/${GAUGE_PACKAGE_NAME//-/_}-$GAUGE_VERSION.tar.gz`
   170            python -m twine upload --non-interactive $gauge_package
   171  
   172    npm-release:
   173      runs-on: ubuntu-latest
   174      needs: [gauge-version]
   175      steps:
   176        - uses: actions/checkout@v4
   177        - run: git fetch --prune --unshallow
   178  
   179        - uses: actions/setup-node@v4
   180          with:
   181            node-version: 20
   182            cache: 'npm'
   183            cache-dependency-path: 'build/npm/package-lock.json'
   184            registry-url: 'https://registry.npmjs.org'
   185  
   186        - name: Fetch gauge version
   187          uses: actions/download-artifact@v4
   188          with:
   189            name: gauge-version
   190            path: .
   191  
   192        - name: Set gauge version
   193          run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
   194  
   195        - name: Setup Git User
   196          run: |
   197            git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
   198            git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
   199  
   200        - name: Deploy npm
   201          env:
   202            NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
   203          run: |
   204            cd build/npm
   205            npm version $GAUGE_VERSION
   206            npm publish --access=public
   207  
   208    choco-release:
   209      runs-on: windows-latest
   210      needs: [gauge-version, windows-package]
   211      steps:
   212        - uses: actions/checkout@v4
   213        - run: git fetch --prune --unshallow
   214  
   215        - name: Fetch gauge version
   216          uses: actions/download-artifact@v4
   217          with:
   218            name: gauge-version
   219            path: .
   220  
   221        - uses: actions/download-artifact@v4
   222          with:
   223            name: gauge-windows-artifact
   224            path: ./deploy
   225  
   226        - name: Set gauge version
   227          run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
   228          shell: bash
   229  
   230        - name: Clone chocolatey-packages
   231          run: |
   232            git clone https://github.com/getgauge/chocolatey-packages
   233  
   234        - name: Deploy to Gauge $GAUGE_VERSION to choco
   235          shell: pwsh
   236          env:
   237            API_KEY: ${{ secrets.NUGET_API_KEY }}
   238          run: |
   239            cd chocolatey-packages
   240            $Env:GAUGE_VERSION | Set-Content version
   241            cd gauge
   242            ./package.ps1
   243            choco push "gauge.$Env:GAUGE_VERSION.nupkg" --apikey=$Env:API_KEY --source=https://push.chocolatey.org/
   244  
   245    brew-release:
   246      runs-on: ubuntu-latest
   247      needs: [gauge-version]
   248      steps:
   249        - uses: actions/checkout@v4
   250        - run: git fetch --prune --unshallow
   251  
   252        - name: Set up Ruby
   253          uses: ruby/setup-ruby@v1
   254          with:
   255            ruby-version: 3.3
   256  
   257        - name: Fetch gauge version
   258          uses: actions/download-artifact@v4
   259          with:
   260            name: gauge-version
   261            path: .
   262  
   263        - name: Set gauge version
   264          run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
   265  
   266        - name: Update brew formula
   267          env:
   268            HOMEBREW_GITHUB_USER_NAME: ${{ secrets.HOMEBREW_GITHUB_USER_NAME }}
   269            HOMEBREW_GITHUB_USER_EMAIL: ${{ secrets.HOMEBREW_GITHUB_USER_EMAIL }}
   270            GITHUB_TOKEN: ${{ secrets.GAUGEBOT_GITHUB_TOKEN }}
   271          run: |
   272            cd build/brew
   273            bash create_brew_pr.sh