Update version for Golang 1.24.5 and Alpine 3.22 #32
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: GitHub Build and Package Mac | |
| on: | |
| push: | |
| branches: | |
| - master | |
| release: | |
| types: | |
| - created | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| ImageName: 'devopcorner/k8s-context' | |
| AppName: 'k8s-context' | |
| strategy: | |
| matrix: | |
| os: [macos-latest] | |
| arch: [arm64] | |
| steps: | |
| - name: Checkout code at release tag | |
| uses: actions/checkout@v2 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Set up Go environment | |
| uses: actions/setup-go@v2 | |
| with: | |
| go-version: 1.19 | |
| - name: Install dependencies | |
| working-directory: src | |
| run: | | |
| go mod tidy | |
| - name: Build binary | |
| working-directory: src | |
| run: | | |
| GOOS=${{ matrix.os }} | |
| GOARCH=${{ matrix.arch }} | |
| go build -o ${{ env.AppName }}-${{ matrix.os }}-${{ matrix.arch }} main.go | |
| - name: Install Xcode command line tools | |
| working-directory: src | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| xcode-select --install || true | |
| - name: Create .pkg package for macOS ARM64 | |
| working-directory: src | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| mkdir -p pkgroot/usr/local/bin/ | |
| cp -r ${{ env.AppName }}-macos-latest-${{ matrix.arch }} pkgroot/usr/local/bin/${{ env.AppName }} | |
| pkgbuild --identifier com.${{ env.AppName }}.pkg --version ${{ github.ref_name }} --install-location /usr/local/bin pkgroot ${{ env.AppName }}-${{ matrix.os }}-${{ matrix.arch }}.pkg | |
| rm -rf pkgroot || true | |
| - name: Create .zip package for macOS ARM64 | |
| working-directory: src | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| mkdir -p ${env.AppName}-macos-${{ matrix.arch }} | |
| cp -r ${{ env.AppName }}-macos-latest-${{ matrix.arch }} ${env.AppName}-macos-${{ matrix.arch }}/${env.AppName}} | |
| zip -r ${env.AppName}-macos-${{ matrix.arch }}.zip ${env.AppName}-macos-${{ matrix.arch }}/ | |
| - name: Upload packages | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| name: ${{ env.AppName }} | |
| path: | | |
| ${env.AppName}-macos-arm64.pkg | |
| ${env.AppName}-macos-arm64.zip |