|
| 1 | +name: Go |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + - v* |
| 7 | + |
| 8 | +jobs: |
| 9 | + v2: |
| 10 | + name: "Version Relase" |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Setup stage golang environment |
| 14 | + uses: actions/setup-go@v4 |
| 15 | + with: |
| 16 | + go-version: stable |
| 17 | + id: go |
| 18 | + |
| 19 | + - name: Check out code into the Go module directory |
| 20 | + uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Cache Go Modules |
| 23 | + uses: actions/cache@v1 |
| 24 | + with: |
| 25 | + path: ~/go/pkg/mod |
| 26 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 27 | + restore-keys: | |
| 28 | + ${{ runner.os }}-go- |
| 29 | +
|
| 30 | + - name: Setup Nodejs and npm |
| 31 | + uses: actions/setup-node@v2 |
| 32 | + with: |
| 33 | + node-version: "16" |
| 34 | + |
| 35 | + # - name: Build Frontend |
| 36 | + # run: | |
| 37 | + # cd devops-frontend |
| 38 | + # yarn install --frozen-lockfile |
| 39 | + # yarn build |
| 40 | + |
| 41 | + - name: Install goreleaser |
| 42 | + run: | |
| 43 | + wget -q https://github.com/goreleaser/goreleaser/releases/download/v1.17.2/goreleaser_Linux_x86_64.tar.gz |
| 44 | + tar -xzf goreleaser_Linux_x86_64.tar.gz |
| 45 | + sudo mv goreleaser /usr/local/bin/ |
| 46 | +
|
| 47 | + - uses: ypicard/get-branch-name-github-action@v1 |
| 48 | + id: current-branch |
| 49 | + |
| 50 | + - name: Set up Google Application Credentials |
| 51 | + run: | |
| 52 | + echo '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}' > credentials.json |
| 53 | + echo 'GOOGLE_APPLICATION_CREDENTIALS=${{ github.workspace }}/credentials.json' >> $GITHUB_ENV |
| 54 | +
|
| 55 | + - name: Run Build and Release script |
| 56 | + run: | |
| 57 | + # Download Go Releaser |
| 58 | + echo "Echo: Current branch is ${{ steps.current-branch.outputs.branch}}" |
| 59 | +
|
| 60 | + # echo "Creating tag..." |
| 61 | + git config --global user.email "[email protected]" |
| 62 | + git config --global user.name "sharadregoti" |
| 63 | + git fetch origin ${{ steps.current-branch.outputs.branch}}:${{ steps.current-branch.outputs.branch}} |
| 64 | + git checkout ${{ steps.current-branch.outputs.branch}} |
| 65 | + git checkout -b "temp-branch" |
| 66 | + TIMESTAMP=$(date +%s) |
| 67 | + git tag -a "v0.5.1" -m "dummy tag" |
| 68 | + echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV |
| 69 | +
|
| 70 | + echo "Running script..." |
| 71 | + bash release.sh |
| 72 | +
|
| 73 | + # - name: Run Build and Release script |
| 74 | + # run: | |
| 75 | + # # Download Go Releaser |
| 76 | + # echo "Echo: Current branch is ${{ steps.current-branch.outputs.branch}}" |
| 77 | + |
| 78 | + # # echo "Creating tag..." |
| 79 | + # git config --global user.email "[email protected]" |
| 80 | + # git config --global user.name "sharadregoti" |
| 81 | + # git fetch origin ${{ steps.current-branch.outputs.branch}}:${{ steps.current-branch.outputs.branch}} |
| 82 | + # git checkout ${{ steps.current-branch.outputs.branch}} |
| 83 | + # git tag -a ${{ steps.current-branch.outputs.branch}} -m "dummy tag" |
| 84 | + # echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV |
| 85 | + |
| 86 | + # echo "Running script..." |
| 87 | + # bash release.sh |
0 commit comments