feat(ci): Improve workflow scripts
This commit is contained in:
22
.github/workflows/publish.yml
vendored
22
.github/workflows/publish.yml
vendored
@@ -25,13 +25,8 @@ jobs:
|
|||||||
metadata:
|
metadata:
|
||||||
name: Metadata
|
name: Metadata
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
|
||||||
tags: ${{ steps.tags.outputs.tags }}
|
|
||||||
vcs_ref: ${{ steps.vcs_ref.outputs.vcs_ref }}
|
|
||||||
created_on: ${{ steps.created_on.outputs.created_on }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Image Tags
|
- name: Image Tags
|
||||||
id: tags
|
|
||||||
run: |
|
run: |
|
||||||
IMAGE_TAG="${{ github.event.release.tag_name }}"
|
IMAGE_TAG="${{ github.event.release.tag_name }}"
|
||||||
[ -z "${IMAGE_TAG}" ] && IMAGE_TAG='latest'
|
[ -z "${IMAGE_TAG}" ] && IMAGE_TAG='latest'
|
||||||
@@ -46,24 +41,19 @@ jobs:
|
|||||||
echo "Docker image: '${DOCKER_IMAGE}'"
|
echo "Docker image: '${DOCKER_IMAGE}'"
|
||||||
echo "Tags: ${TAGS}"
|
echo "Tags: ${TAGS}"
|
||||||
|
|
||||||
# FIXME: set-output is deprecated
|
echo "TAGS=${TAGS}" >> $GITHUB_ENV
|
||||||
echo ::set-output name=tags::${TAGS}
|
|
||||||
|
|
||||||
- name: VCS ref
|
- name: VCS ref
|
||||||
id: vcs_ref
|
|
||||||
run: |
|
run: |
|
||||||
VCS_REF="${GITHUB_SHA::8}"
|
VCS_REF="${GITHUB_SHA::8}"
|
||||||
echo "VCS ref: ${VCS_REF}"
|
echo "VCS ref: ${VCS_REF}"
|
||||||
# FIXME: set-output is deprecated
|
echo "VCS_REF=${VCS_REF}" >> $GITHUB_ENV
|
||||||
echo ::set-output name=vcs_ref::${VCS_REF}
|
|
||||||
|
|
||||||
- name: Created On
|
- name: Created On
|
||||||
id: created_on
|
|
||||||
run: |
|
run: |
|
||||||
CREATED_ON="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
CREATED_ON="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
||||||
echo "Created on: ${CREATED_ON}"
|
echo "Created on: ${CREATED_ON}"
|
||||||
# FIXME: set-output is deprecated
|
echo "CREATED_ON=${CREATED_ON}" >> $GITHUB_ENV
|
||||||
echo ::set-output name=created_on::${CREATED_ON}
|
|
||||||
|
|
||||||
- name: Dump environment
|
- name: Dump environment
|
||||||
if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == true
|
if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == true
|
||||||
@@ -136,12 +126,12 @@ jobs:
|
|||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
platforms: ${{ env.PLATFORMS }}
|
platforms: ${{ env.PLATFORMS }}
|
||||||
build-args: |
|
build-args: |
|
||||||
VCS_REF=${{ needs.metadata.outputs.vcs_ref }}
|
VCS_REF=${{ env.VCS_REF }}
|
||||||
BUILD_DATE=${{ needs.metadata.outputs.created_on }}
|
BUILD_DATE=${{ env.CREATED_ON }}
|
||||||
cache-from: |
|
cache-from: |
|
||||||
type=local,src=${{ env.CACHE_PATH }}
|
type=local,src=${{ env.CACHE_PATH }}
|
||||||
ghcr.io/cdalvaro/docker-salt-master:latest
|
ghcr.io/cdalvaro/docker-salt-master:latest
|
||||||
cache-to: type=local,dest=${{ env.CACHE_PATH }}
|
cache-to: type=local,dest=${{ env.CACHE_PATH }}
|
||||||
pull: true
|
pull: true
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ needs.metadata.outputs.tags }}
|
tags: ${{ env.TAGS }}
|
||||||
|
|||||||
3
.github/workflows/security-analysis.yml
vendored
3
.github/workflows/security-analysis.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
name: Trivy scan
|
name: Trivy scan
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
CACHE_PATH: /tmp/.buildx-cache
|
CACHE_PATH: ${{ github.workspace }}/.buildx-cache
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -47,6 +47,7 @@ jobs:
|
|||||||
type=local,src=${{ env.CACHE_PATH }}
|
type=local,src=${{ env.CACHE_PATH }}
|
||||||
ghcr.io/cdalvaro/docker-salt-master:latest
|
ghcr.io/cdalvaro/docker-salt-master:latest
|
||||||
cache-to: type=local,dest=${{ env.CACHE_PATH }}
|
cache-to: type=local,dest=${{ env.CACHE_PATH }}
|
||||||
|
pull: true
|
||||||
load: true
|
load: true
|
||||||
tags: ghcr.io/cdalvaro/docker-salt-master:${{ github.sha }}
|
tags: ghcr.io/cdalvaro/docker-salt-master:${{ github.sha }}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user