Skip to content

Commit

Permalink
GHA: correct the install-pr.yml
Browse files Browse the repository at this point in the history
    - GITHUB_ENV cannot be used cross jobs
    - correct the GITHUB_ENV setup with multiple lines file

Signed-off-by: Vicente Cheng <[email protected]>
  • Loading branch information
Vicente-Cheng committed Feb 3, 2025
1 parent 61a1a66 commit 9e02379
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/installer-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ env:
IMAGE_NAME: rancher/harvester-os:${{ inputs.tag }}

jobs:
generate-image-diff:
create-installer-pr:
runs-on: ubuntu-latest
container:
image: registry.suse.com/bci/bci-base:15.5
steps:
needs: generate-image-diff
steps:
- name: fetch-target-version
run: |
echo "targetVersion=$(echo ${{ inputs.tag }} | cut -d'-' -f1)" >> $GITHUB_ENV
echo "Get targetVersion: $targetVersion"
- name: Install docker
run: zypper ref && zypper -n install docker
- name: Pull release image
Expand All @@ -38,21 +38,11 @@ jobs:
echo "Diff $BASE_OS_IMAGE with ${{ env.IMAGE_NAME }}..."
container-diff diff daemon://docker.io/$BASE_OS_IMAGE daemon://docker.io/${{ env.IMAGE_NAME }} --type=rpm --output=diff-result.txt
cat diff-result.txt
echo "packagesDiff=$(cat diff-result.txt)" >> $GITHUB_ENV
create-installer-pr:
runs-on: ubuntu-latest
needs: generate-image-diff
steps:
- name: Download container-diff result
uses: actions/download-artifact@v3
with:
name: diff-result
- name: Read diff result
- name: Set diff result to environment variable
run: |
echo "DIFF=$(cat ./diff-result.txt)" >> $GITHUB_ENV
- name: Remove unused files
run: rm diff-result.txt
echo "packagesDiff<<EOF" >> $GITHUB_ENV
cat diff-result.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Clone harvester-installer repo
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -93,11 +83,9 @@ jobs:
runs-on: ubuntu-latest
needs: generate-image-diff
steps:
- uses: jungwinter/split@v2
id: spliter
with:
msg: ${{ github.ref_name }}
separator: '-'
- name: fetch-target-version
run: |
echo "targetVersion=$(echo ${{ inputs.tag }} | cut -d'-' -f1)" >> $GITHUB_ENV
- name: Clone Addons repo
uses: actions/checkout@v3
with:
Expand Down

0 comments on commit 9e02379

Please sign in to comment.