Skip to content

Commit

Permalink
Conditional artifacts upload.
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rj1k committed Mar 12, 2024
1 parent 9cda0b8 commit ac27beb
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 8 deletions.
40 changes: 32 additions & 8 deletions .github/workflows/ci-deb-packages-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ jobs:
if-no-files-found: warn

- name: Copy git hash
if: >-
${{
github.event_name == 'pull_request' &&
contains(github.event.pull_request.title, ':upload-artifacts') ||
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/')
}}
shell: sh
env:
GITHUB_SHA: ${{ github.sha }}
Expand All @@ -257,27 +265,43 @@ jobs:
echo $GITHUB_SHA > hash.txt
- name: Compress files
if: >-
${{
github.event_name == 'pull_request' &&
contains(github.event.pull_request.title, ':upload-artifacts') ||
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/')
}}
shell: sh
run: |
tar -czvf ${{ env.IMAGE_TAG }}.tar.gz $(ls -1 | grep -E '(.deb|hash.txt)$' | tr -s '\n' ' ')
- name: Generate SHA checksum
if: >-
${{
github.event_name == 'pull_request' &&
contains(github.event.pull_request.title, ':upload-artifacts') ||
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/')
}}
shell: sh
run: |
sha512sum ${{ env.IMAGE_TAG }}.tar.gz > ${{ env.IMAGE_TAG }}.sha1
- uses: actions/upload-artifact@v4
if: >-
${{
github.event_name == 'pull_request' &&
contains(github.event.pull_request.title, ':upload-artifacts') ||
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/')
}}
with:
name: deb-${{ env.IMAGE_TAG }}-artifact
path: |
*.tar.gz
*.sha1
if-no-files-found: error

- uses: actions/upload-artifact@v4
if: ${{ inputs.USE_CMAKE == false }}
with:
name: deb-${{ env.IMAGE_TAG }}-changelog-artifact
path: |
./debian/changelog
if-no-files-found: error
32 changes: 32 additions & 0 deletions .github/workflows/ci-rpm-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,51 @@ jobs:
signalwire_token: ${{ secrets.SIGNALWIRE_TOKEN }}

- name: Generate hash file
if: >-
${{
github.event_name == 'pull_request' &&
contains(github.event.pull_request.title, ':upload-artifacts') ||
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/')
}}
run: echo $GITHUB_SHA > hash.txt
env:
GITHUB_SHA: ${{ github.sha }}

- name: Compress files
if: >-
${{
github.event_name == 'pull_request' &&
contains(github.event.pull_request.title, ':upload-artifacts') ||
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/')
}}
run: |
tar -czvf ${{ inputs.TARGET_ARTIFACT_NAME }}.tar.gz $(ls -1 | grep -E '(.rpm|hash.txt)$' | tr -s '\n' ' ')
- name: Generate SHA checksum
if: >-
${{
github.event_name == 'pull_request' &&
contains(github.event.pull_request.title, ':upload-artifacts') ||
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/')
}}
run: |
sha512sum ${{ inputs.TARGET_ARTIFACT_NAME }}.tar.gz > ${{ inputs.TARGET_ARTIFACT_NAME }}.sha1
- uses: actions/upload-artifact@v4
if: >-
${{
github.event_name == 'pull_request' &&
contains(github.event.pull_request.title, ':upload-artifacts') ||
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/')
}}
with:
name: rpm-${{ inputs.PLATFORM }}-artifact
path: |
Expand Down

0 comments on commit ac27beb

Please sign in to comment.