Improve alias generation #21
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 and Snapshot Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * 0' # Weekly on Sunday at midnight | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| build: | |
| name: Build and Test on All Platforms | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| go-version: [">=1.23.5"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: go mod tidy -e || true | |
| - name: Lint Go files | |
| run: go fmt ./... | |
| - name: Build binary | |
| run: python3 .github/workflows/build.py | |
| - name: Install cf | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo gpg --dearmor -o /usr/share/keyrings/cli.cloudfoundry.org.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/cli.cloudfoundry.org.gpg] https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list | |
| sudo apt-get update | |
| sudo apt-get install -y cf8-cli | |
| - name: Install cf plugin | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| make install | |
| - name: Run 'cf java generate-alias-script' | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| cf java generate-alias-script > dist/script.sh | |
| - name: Upload script.sh | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.os == 'ubuntu-latest' | |
| with: | |
| name: script.sh | |
| path: dist/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cf-cli-java-plugin-${{ matrix.os }} | |
| path: dist/ | |
| release: | |
| name: Create Snapshot Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist/ # Specify the directory where artifacts will be downloaded | |
| - name: Combine all artifacts | |
| run: | | |
| mkdir -p dist | |
| mv dist/*/* dist/ || true | |
| - uses: thomashampson/delete-older-releases@main | |
| with: | |
| keep_latest: 0 | |
| delete_tag_regex: snapshot | |
| prerelease_only: true | |
| delete_tags: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: dist/* | |
| prerelease: true | |
| tag_name: snapshot | |
| overwrite: true | |
| body: | | |
| This is a snapshot release of the cf-cli-java-plugin. | |
| It includes the latest changes and is not intended for production use. | |
| Please test it and provide feedback. | |
| name: Snapshot Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |