|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: terraform-google-storage-bucket-iam |
| 10 | + cancel-in-progress: false |
| 11 | + |
| 12 | +jobs: |
| 13 | + pre-commit: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + name: Static Analysis |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + # actions/checkout@v4.1.1 |
| 19 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Setup asdf |
| 24 | + # asdf-vm/actions/plugins-add@v3.0.2 |
| 25 | + uses: asdf-vm/actions/plugins-add@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 |
| 26 | + |
| 27 | + - name: Install tools via asdf |
| 28 | + run: asdf install |
| 29 | + |
| 30 | + - name: Set up Golang |
| 31 | + # actions/setup-go@v5.0.0 |
| 32 | + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 |
| 33 | + with: |
| 34 | + go-version: 1.22.0 |
| 35 | + |
| 36 | + - name: Set up Terradoc |
| 37 | + # for security reasons we pin commit ids and not tags. |
| 38 | + # mineiros-io/terradoc@main -> af1a7b3ae3635958adf5ee2f40e0c3e70fd0803a |
| 39 | + run: go install github.com/mineiros-io/terradoc/cmd/terradoc@af1a7b3ae3635958adf5ee2f40e0c3e70fd0803a |
| 40 | + env: |
| 41 | + GOPROXY: direct |
| 42 | + |
| 43 | + - name: Cache plugin dir |
| 44 | + # for security reasons we pin commit ids and not tags. |
| 45 | + # actions/cache@v4.0.0 -> 13aacd865c20de90d75de3b17ebe84f7a17d57d2 |
| 46 | + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 |
| 47 | + with: |
| 48 | + path: ~/.tflint.d/plugins |
| 49 | + key: tflint-${{ hashFiles('.tflint.hcl') }} |
| 50 | + |
| 51 | + - name: Init TFLint |
| 52 | + run: tflint --init |
| 53 | + env: |
| 54 | + # https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting |
| 55 | + GITHUB_TOKEN: ${{ github.token }} |
| 56 | + |
| 57 | + - name: Setup and run pre-commit |
| 58 | + # for security reasons we pin commit ids and not tags. |
| 59 | + # pre-commit/action@v3.0.1 -> 2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd |
| 60 | + uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd |
| 61 | + |
| 62 | + unit-tests: |
| 63 | + # needs: pre-commit |
| 64 | + runs-on: ubuntu-latest |
| 65 | + name: Unit Tests |
| 66 | + steps: |
| 67 | + - name: Checkout |
| 68 | + # actions/checkout@v4.1.1 |
| 69 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 70 | + with: |
| 71 | + fetch-depth: 0 |
| 72 | + |
| 73 | + - name: Setup asdf |
| 74 | + # asdf-vm/actions/plugins-add@v3.0.2 |
| 75 | + uses: asdf-vm/actions/plugins-add@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 |
| 76 | + |
| 77 | + - name: Install tools via asdf |
| 78 | + run: asdf install |
| 79 | + |
| 80 | + - name: Set up Golang |
| 81 | + # actions/setup-go@v5.0.0 |
| 82 | + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 |
| 83 | + with: |
| 84 | + go-version: 1.22.0 |
| 85 | + |
| 86 | + - name: Run Unit Tests |
| 87 | + run: make test/unit-tests |
| 88 | + env: |
| 89 | + GOOGLE_CREDENTIALS: ${{ secrets.MINEIROS_TESTING_GCP_SA_KEY_FILE }} |
| 90 | + TEST_GCP_PROJECT: ${{ secrets.MINEIROS_TESTING_GCP_PROJECT }} |
| 91 | + TEST_GCP_ORG_DOMAIN: ${{ secrets.MINEIROS_TESTING_GCP_ORG_DOMAIN }} |
| 92 | + |
| 93 | + release: |
| 94 | + needs: |
| 95 | + - pre-commit |
| 96 | + - unit-tests |
| 97 | + permissions: |
| 98 | + contents: write |
| 99 | + issues: write |
| 100 | + runs-on: ubuntu-latest |
| 101 | + steps: |
| 102 | + - name: Checkout |
| 103 | + # actions/checkout@v4.1.1 |
| 104 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 105 | + with: |
| 106 | + fetch-depth: 0 |
| 107 | + |
| 108 | + - name: Semantic Release |
| 109 | + # codfish/semantic-release-action@v3.1.0 |
| 110 | + uses: codfish/semantic-release-action@07170c8b1613177f0f3aa4d2224e2e0933cd732c |
| 111 | + id: semantic |
| 112 | + env: |
| 113 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 114 | + with: |
| 115 | + plugins: | |
| 116 | + ['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/github'] |
0 commit comments