Moving direct dependencies to the same require block at go.mod #63
This file contains hidden or 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: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - pre-release | |
| - build-workflow | |
| permissions: | |
| contents: read | |
| statuses: write | |
| env: | |
| PKG_NAME: "tofu-ls" | |
| jobs: | |
| get-go-version: | |
| name: "Determine Go toolchain version" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| go-version: ${{ steps.get-go-version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Determine Go version | |
| id: get-go-version | |
| uses: ./.github/actions/go-version | |
| get-product-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| product-version: ${{ steps.get-product-version.outputs.product-version }} | |
| product-base-version: ${{ steps.get-product-version.outputs.base-product-version }} | |
| product-prerelease-version: ${{ steps.get-product-version.outputs.prerelease-product-version }} | |
| steps: | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| - name: Get Product version | |
| id: get-product-version | |
| uses: hashicorp/actions-set-product-version@b426ea77cad0389738a8a81d89e933146a3ba97f # unreleased, untagged (upgrade of actions/checkout) | |
| generate-provider-schemas: | |
| needs: get-go-version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Checkout directory" | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| - name: Set up Go | |
| uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
| with: | |
| go-version: ${{ needs.get-go-version.outputs.go-version }} | |
| - name: Generate provider schemas | |
| run: | | |
| go generate ./internal/schemas | |
| du -h -s ./internal/schemas/data | |
| - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
| with: | |
| name: provider-schema-data | |
| path: ./internal/schemas/data | |
| retention-days: 1 | |
| build: | |
| needs: | |
| - get-go-version | |
| - get-product-version | |
| - generate-provider-schemas | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - { goos: "linux", goarch: "386" } | |
| - { goos: "linux", goarch: "amd64" } | |
| - { goos: "linux", goarch: "arm" } | |
| - { goos: "linux", goarch: "arm64" } | |
| - { goos: "freebsd", goarch: "386" } | |
| - { goos: "freebsd", goarch: "amd64" } | |
| - { goos: "freebsd", goarch: "arm" } | |
| - { goos: "openbsd", goarch: "386" } | |
| - { goos: "openbsd", goarch: "amd64" } | |
| - { goos: "solaris", goarch: "amd64" } | |
| - { goos: "windows", goarch: "386" } | |
| - { goos: "windows", goarch: "amd64" } | |
| - { goos: "windows", goarch: "arm64" } | |
| - { goos: "darwin", goarch: "arm64" } | |
| - { goos: "darwin", goarch: "amd64" } | |
| fail-fast: true | |
| name: Go ${{ needs.get-go-version.outputs.go-version }} ${{ matrix.goos }} ${{ matrix.goarch }} build | |
| steps: | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| - name: Download provider schemas | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
| with: | |
| name: provider-schema-data | |
| path: ./internal/schemas/data | |
| - name: Check provider schemas | |
| run: du -h -s ./internal/schemas/data | |
| - uses: hashicorp/actions-go-build@37358f6098ef21b09542d84a9814ebb843aa4e3e # v1.0.0 | |
| env: | |
| BASE_VERSION: ${{ needs.get-product-version.outputs.product-base-version }} | |
| PRERELEASE_VERSION: ${{ needs.get-product-version.outputs.product-prerelease-version}} | |
| CGO_ENABLED: 0 | |
| with: | |
| product_name: ${{ env.PKG_NAME }} | |
| product_version: ${{ needs.get-product-version.outputs.product-version }} | |
| go_version: ${{ needs.get-go-version.outputs.go-version }} | |
| os: ${{ matrix.goos }} | |
| arch: ${{ matrix.goarch }} | |
| reproducible: report | |
| instructions: |- | |
| go build \ | |
| -o "$BIN_PATH" \ | |
| -trimpath \ | |
| -buildvcs=false \ | |
| -ldflags " | |
| -s -w | |
| " | |
| cp LICENSE "$TARGET_DIR/LICENSE.txt" | |
| - name: Copy license file to config_dir # for Linux packages | |
| if: ${{ matrix.goos == 'linux' }} | |
| env: | |
| LICENSE_DIR: ".release/linux/package/usr/share/doc/${{ env.PKG_NAME }}" | |
| run: | | |
| mkdir -p "$LICENSE_DIR" && cp LICENSE "$LICENSE_DIR/LICENSE.txt" | |
| - name: Package | |
| if: ${{ matrix.goos == 'linux' }} | |
| uses: hashicorp/actions-packaging-linux@514d75d0961adeddf1f928fb93b82f41735fc488 # v1.6.0 | |
| with: | |
| name: ${{ github.event.repository.name }} | |
| description: "OpenTofu Language Server" | |
| arch: ${{ matrix.goarch }} | |
| version: ${{ needs.get-product-version.outputs.product-version }} | |
| maintainer: "OpenTofu" | |
| homepage: "https://github.com/opentofu/tofu-ls" | |
| license: "MPL-2.0" | |
| binary: "dist/${{ env.PKG_NAME }}" | |
| deb_depends: "openssl" | |
| rpm_depends: "openssl" | |
| config_dir: ".release/linux/package/" | |
| - name: Set Package Names | |
| if: ${{ matrix.goos == 'linux' }} | |
| run: | | |
| echo "RPM_PACKAGE=$(basename out/*.rpm)" >> $GITHUB_ENV | |
| echo "DEB_PACKAGE=$(basename out/*.deb)" >> $GITHUB_ENV | |
| - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
| if: ${{ matrix.goos == 'linux' }} | |
| with: | |
| name: ${{ env.RPM_PACKAGE }} | |
| path: out/${{ env.RPM_PACKAGE }} | |
| - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
| if: ${{ matrix.goos == 'linux' }} | |
| with: | |
| name: ${{ env.DEB_PACKAGE }} | |
| path: out/${{ env.DEB_PACKAGE }} |