Skip to content

Update README, fix #39 #32

Update README, fix #39

Update README, fix #39 #32

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: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cf-cli-java-plugin-${{ matrix.os }}
path: dist/
- 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
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
ls -alsh 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: false
release: false
tag_name: snapshot
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 }}