docs(README): #128. Update readme . (#173) #2
This file contains 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: Publish go-oscal | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tag-new-version: | |
name: Tag New Version | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release-flag.outputs.release_created }} | |
steps: | |
- name: Create release tag | |
id: tag | |
uses: google-github-actions/release-please-action@cc61a07e2da466bebbc19b3a7dd01d6aecb20d1e # v4 | |
with: | |
release-type: "go" | |
- id: release-flag | |
run: echo "release_created=${{ steps.tag.outputs.release_created || false }}" >> $GITHUB_OUTPUT | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
needs: tag-new-version | |
if: ${{ needs.tag-new-version.outputs.release_created == 'true'}} | |
steps: | |
# Checkout the repo and setup the tooling for this job | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Setup golang | |
uses: ./.github/actions/golang | |
- name: Build CLI | |
run: | | |
make build | |
# Upload the contents of the build directory for later stages to use | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: build-artifacts | |
path: bin/ | |
retention-days: 1 | |
validate: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
# Checkout the repo and setup the tooling for this job | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Download build artifacts | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | |
with: | |
name: build-artifacts | |
path: bin/ | |
- name: Setup golang | |
uses: ./.github/actions/golang | |
- name: Make go-oscal executable | |
run: | | |
chmod +x bin/go-oscal | |
# Build the example packages and run the tests | |
- name: Run e2e tests | |
run: | | |
make test | |
- name: Save logs | |
if: always() | |
uses: ./.github/actions/save-logs | |
push: | |
runs-on: ubuntu-latest | |
needs: validate | |
permissions: | |
contents: write | |
steps: | |
# Checkout the repo and setup the tooling for this job | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Setup golang | |
uses: ./.github/actions/golang | |
- name: Install tools | |
uses: ./.github/actions/install-tools | |
- name: Download build artifacts | |
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 | |
with: | |
name: build-artifacts | |
path: bin/ | |
# Create the GitHub release notes | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --rm-dist --debug | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} |