-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yves Brissaud <[email protected]>
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Test and Release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Hub Login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PAT }} | ||
- name: Prepare scout binary | ||
run: | | ||
tar -xf dist/docker-scout_*_linux_amd64.tar.gz -C . | ||
chmod +x docker-scout | ||
- name: Test scout binary | ||
run: | | ||
./docker-scout version | ||
./docker-scout quickview alpine:latest | ||
./docker-scout cves docker/scout-demo-service:main | ||
./docker pull docker/scout-demo-service:fix | ||
./docker-scout compare registry://docker/scout-demo-service:main --to local://docker/scout-demo-service:fix | ||
release: | ||
if: startsWith(github.head_ref, 'release/v') | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: main | ||
- name: Tag name | ||
uses: mad9000/actions-find-and-replace-string@2 | ||
id: tagname | ||
with: | ||
source: ${{ github.head_ref }} | ||
find: 'release/' | ||
replace: '' | ||
- name: Merge and Tag | ||
run: | | ||
git config --unset-all http.https://github.com/.extraheader | ||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
git config --global user.name "${GITHUB_ACTOR}" | ||
git merge --ff-only origin/${{ github.head_ref }} | ||
git tag ${{ steps.tagname.outputs.value }} | ||
git push https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:main --tags |
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