Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Actions - Link Artifacts in PR comments #965

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ on:
types: [build]

name: Build EmuFlight
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions: write-all
#permissions:
# id-token: write
# contents: read
# issues: write
# pull-requests: write

jobs:
build:
continue-on-error: false
Expand Down Expand Up @@ -87,19 +96,15 @@ jobs:
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
continue-on-error: true

- name: Make artifact name
id: make_artifactname
- name: set artifact name
id: set_artifactname
run: |
if [[ "${{ github.REPOSITORY }}" == "emuflight/EmuFlight" ]] ; then
ARTIFACT_NAME="EmuFlight-${{ env.VERSION }}-${{ github.run_number }}"
else
ARTIFACT_NAME="EmuFlight-${{ env.VERSION }}-${{ github.ACTOR }}-${{ github.run_number }}"
fi
ARTIFACT_NAME="EmuFlight-${{ env.VERSION }}-${{ github.run_number }}-${{ env.SHORT_SHA }}"
echo "${ARTIFACT_NAME}"
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV

- id: ids
name : set outputs
- name: set outputs
id: ids
run: |
echo "::set-output name=buildtag::${{ env.REVISION_TAG }}"
echo "::set-output name=shortsha::${{ env.SHORT_SHA }}"
Expand All @@ -122,7 +127,7 @@ jobs:
echo "outputs.buildtag: ${{ steps.ids.outputs.buildtag }}"
echo "outputs.shortsha: ${{ steps.ids.outputs.shortsha }}"
echo "outputs.artfact: ${{ steps.ids.outputs.artifact }}"
echo "outputs.artfact: ${{ steps.ids.outputs.artifact }}"
echo "outputs.version: ${{ steps.ids.outputs.version }}"
continue-on-error: true

# Build HEX
Expand All @@ -132,11 +137,25 @@ jobs:

# Upload the Builds to ZIP file with existing SHA in .hex names
- name: Upload Artifacts
uses: actions/upload-artifact@v2
id: artifact-upload
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: obj/*.hex

artifacts:
if: github.event_name == 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions: write-all
continue-on-error: false
steps:
- name: Add artifacts link
uses: beni69/artifact-link@v1
with:
token: ${{ secrets.NC_PAT_EMUF }}
summary: false
continue-on-error: true

releases:
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -158,12 +177,12 @@ jobs:
echo "outputs.buildtag: ${{ needs.build.outputs.buildtag }}"
echo "outputs.shortsha: ${{ needs.build.outputs.shortsha }}"
echo "outputs.artfact: ${{ needs.build.outputs.artifact }}"
echo "outputs.artfact: ${{ needs.build.outputs.version }}"
echo "outputs.version: ${{ needs.build.outputs.version }}"
echo "NOW=$(date +'%Y%m%d.%H%M%S')" >> $GITHUB_ENV
continue-on-error: true

- name: download artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.artifact }} #no name parameter will download all artifacts, but create separate subfolders
path: obj
Expand Down
Loading