Exclude the provider/cmd/pkg directory from git to make goreleaser ha… #28
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: build | |
on: | |
push: | |
branches: | |
- main | |
- 'release/**' | |
pull_request: | |
branches: | |
- main | |
- 'release/**' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GOPATH: ${{ github.workspace }}/provider/cmd | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
# Used for pulumictl to calculate the correct tags :( | |
- name: Unshallow clone for tags | |
run: git fetch --prune --unshallow --tags | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.20.x | |
- name: Install pulumictl | |
uses: jaxxstorm/action-install-gh-release@c5ead9a448b4660cf1e7866ee22e4dc56538031a # v1.10.0 | |
with: | |
repo: pulumi/pulumictl | |
- name: Install Pulumi CLI | |
uses: pulumi/action-install-pulumi-cli@v2 | |
- name: Install Schema Tools | |
if: github.event_name == 'pull_request' | |
uses: jaxxstorm/action-install-gh-release@c5ead9a448b4660cf1e7866ee22e4dc56538031a # v1.10.0 | |
with: | |
repo: pulumi/schema-tools | |
- name: Build | |
run: | | |
export VERSION=`echo $GITHUB_REF | sed -e "s/refs\/heads\///g" -e "s/release\/\|main//g"` | |
export VERSION="$VERSION.$GITHUB_RUN_NUMBER" | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
echo "GORELEASER_CURRENT_TAG=v${VERSION}" >> $GITHUB_ENV | |
# sed -i "s/0.0.0/${VERSION}/g" src/version.go | |
make tfgen | |
make provider | |
- name: Create Github Release and Tag | |
if: github.repository_owner == 'Authress' && github.ref != 'refs/heads/main' && github.event_name == 'push' | |
run: | | |
git tag v${VERSION} -f | |
git push origin v${VERSION} | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
- name: Run GoReleaser | |
if: github.repository_owner == 'Authress' && github.ref != 'refs/heads/main' && github.event_name == 'push' | |
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 | |
with: | |
args: -p 3 release --clean | |
version: latest | |
env: | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: List all files (on failure) | |
if: failure() | |
run: | | |
ls -alR |