ci: authenticate when looking up release information (#1936) (#1939)

This commit is contained in:
mmetc 2022-12-22 10:09:18 +01:00 committed by GitHub
parent dbc06d430f
commit b561a370cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 83 additions and 55 deletions

View file

@ -11,6 +11,18 @@ on:
- 'README.md'
jobs:
get_latest_release:
name: get_latest_release
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- id: get_latest_release
uses: cardinalby/git-get-release-action@cedef2faf69cb7c55b285bad07688d04430b7ada
env:
GITHUB_TOKEN: ${{ github.token }}
with:
latest: true
build:
name: Build
@ -23,13 +35,8 @@ jobs:
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- id: get_latest_release
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: crowdsecurity/crowdsec
excludes: draft
- id: set_release_in_env
run: echo "BUILD_VERSION=${{ steps.get_latest_release.outputs.release }}" >> $env:GITHUB_ENV
run: echo "BUILD_VERSION=${{ jobs.get_latest_release.outputs.tag_name }}" >> $env:GITHUB_ENV
- name: Build
run: make windows_installer
- name: Upload MSI

View file

@ -2,23 +2,33 @@ name: Dispatch to hub when creating pre-release
on:
release:
types: prereleased
types:
- prereleased
jobs:
get_latest_release:
name: get_latest_release
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- id: get_latest_release
uses: cardinalby/git-get-release-action@cedef2faf69cb7c55b285bad07688d04430b7ada
env:
GITHUB_TOKEN: ${{ github.token }}
with:
latest: true
draft: false
prerelease: false
dispatch:
name: dispatch to hub-tests
runs-on: ubuntu-latest
steps:
- id: keydb
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: crowdsecurity
repo: crowdsec
excludes: prerelease, draft
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.DISPATCH_TOKEN }}
event-type: create_branch
repository: crowdsecurity/hub
client-payload: '{"version": "${{ steps.keydb.outputs.release }}"}'
client-payload: '{"version": "${{ jobs.get_latest_release.outputs.tag_name }}"}'

View file

@ -2,23 +2,33 @@ name: Dispatch to hub when deleting pre-release
on:
release:
types: deleted
types:
- deleted
jobs:
get_latest_release:
name: get_latest_release
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- id: get_latest_release
uses: cardinalby/git-get-release-action@cedef2faf69cb7c55b285bad07688d04430b7ada
env:
GITHUB_TOKEN: ${{ github.token }}
with:
latest: true
draft: false
prerelease: false
dispatch:
name: dispatch to hub-tests
runs-on: ubuntu-latest
steps:
- id: keydb
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: crowdsecurity
repo: crowdsec
excludes: prerelease, draft
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.DISPATCH_TOKEN }}
event-type: delete_branch
repository: crowdsecurity/hub
client-payload: '{"version": "${{ steps.keydb.outputs.release }}"}'
client-payload: '{"version": "${{ jobs.get_latest_release.outputs.tag_name }}"}'

View file

@ -3,46 +3,47 @@ name: build
on:
release:
types: prereleased
types:
- prereleased
jobs:
build:
name: Build and upload binary package
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Build the binaries
run: make release
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: crowdsec-release.tgz application/x-gzip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Build the binaries
run: make release
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: crowdsec-release.tgz application/x-gzip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_static:
name: Build and upload binary package
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Build the binaries
run: |
make release BUILD_STATIC=yes
mv crowdsec-release.tgz crowdsec-release-static.tgz
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: crowdsec-release-static.tgz application/x-gzip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Build the binaries
run: |
make release BUILD_STATIC=yes
mv crowdsec-release.tgz crowdsec-release-static.tgz
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: crowdsec-release-static.tgz application/x-gzip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}