add action to append date to artifact name during upload

This commit is contained in:
Tim Yuen 2022-09-12 14:57:51 -04:00
parent be48eadbc6
commit 822e9e7753
2 changed files with 35 additions and 7 deletions

View file

@ -0,0 +1,26 @@
name: Upload dated artifact
description: Uploads an artifact with a datetime
inputs:
name:
description: The name of the artifact
required: true
path:
description: The path to the file/folder to upload
required: true
runs:
using: composite
steps:
# https://stackoverflow.com/questions/60942067/get-current-date-and-time-in-github-workflows
- name: Get current datetime
id: date
shell: bash
run: echo "::set-output name=date::$(date '+%Y-%m-%d_%H-%M-%S')"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.name }}_${{ steps.date.outputs.date }}
path: ${{ inputs.path }}
if-no-files-found: error

View file

@ -34,11 +34,10 @@ jobs:
cp -r models ${{ env.dist-path }} cp -r models ${{ env.dist-path }}
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: ./.github/actions/upload-dated-artifact
with: with:
name: windows-latest name: windows
path: dist # Add the parent directory to prevent a tarbomb path: dist # Add the parent directory to prevent a tarbomb
if-no-files-found: error
# Files must be packed into a tar in order for file permissions to be preserved # Files must be packed into a tar in order for file permissions to be preserved
build-unix: build-unix:
@ -48,7 +47,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, macos-latest] include:
- name: linux
os: ubuntu-latest
- name: mac
os: macos-latest
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Pull OpenSeeFace - name: Pull OpenSeeFace
@ -78,8 +81,7 @@ jobs:
run: tar -cvf ${{ env.tar-path }} ${{ env.artifact-path }} run: tar -cvf ${{ env.tar-path }} ${{ env.artifact-path }}
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: ./.github/actions/upload-dated-artifact
with: with:
name: ${{ matrix.os }} name: ${{ matrix.name }}
path: ${{ env.tar-path }} path: ${{ env.tar-path }}
if-no-files-found: error