diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ffa9a0c..24984f5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,6 +6,13 @@ on: runs-on: required: true type: string + ext-version: + required: false + type: string + default: latest + registry: + required: false + type: string jobs: build: @@ -21,22 +28,53 @@ jobs: with: node-version: 18 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT" + - name: Get yarn cache directory path (Windows) + if: ${{ matrix.os=='windows-2022' }} + id: yarn-cache-dir-path-windows + run: echo "dir=$(yarn cache dir)" >> ${env:GITHUB_OUTPUT} + + - name: Get yarn cache directory path (mac/Linux) + if: ${{ matrix.os=='ubuntu-22.04' || matrix.os=='macos-14' }} + id: yarn-cache-dir-path-unix + run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT} + + - uses: actions/cache@v4 + if: ${{ matrix.os=='windows-2022' }} + id: yarn-cache-windows + with: + path: ${{ steps.yarn-cache-dir-path-windows.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - - uses: actions/cache@v3 - id: yarn-cache + - uses: actions/cache@v4 + if: ${{ matrix.os=='ubuntu-22.04' || matrix.os=='macos-14' }} + id: yarn-cache-unix with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + path: ${{ steps.yarn-cache-dir-path-unix.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - - name: yarn + - name: Install dependencies (no cache found) run: | yarn --frozen-lockfile --network-timeout 180000 - name: Run Build timeout-minutes: 20 run: yarn build + + - name: Login to quay.io + if: ${{ inputs.registry == 'quay' }} + run: podman login --username ${{ secrets.QUAY_ROBOT_NAME }} --password ${{ secrets.QUAY_ROBOT_TOKEN }} quay.io + + - name: Login to ghcr.io + if: ${{ inputs.registry == 'ghrc' }} + run: podman login --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io + + - name: Build and Push Image + if: ${{ inputs.registry == 'ghrc' || inputs.registry == 'quay'}} + id: build-image + run: | + podman build -t quay.io/redhat-developer/podman-desktop-redhat-account-ext:${{ inputs.ext-version }} . + podman push quay.io/redhat-developer/podman-desktop-redhat-account-ext:${{ inputs.ext-version }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e55b765..c922754 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,38 +24,7 @@ on: jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(npx yarn cache dir)" >> ${GITHUB_OUTPUT} - - - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Execute yarn - if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} - run: npx yarn --frozen-lockfile --network-timeout 180000 - - - name: Run Build - run: npx yarn build - - - name: Login to ghcr.io - run: podman login --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io - - - name: Build Image - id: build-image - run: | - podman build -t ghcr.io/${{ github.repository_owner }}/podman-desktop-redhat-account-ext:latest . - podman push ghcr.io/${{ github.repository_owner }}/podman-desktop-redhat-account-ext:latest + uses: redhat-developer/podman-desktop-redhat-account-ext/.github/workflows/build.yaml@main + with: + runs-on: ubuntu-latest + registry: 'ghrc' diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index bd02134..7d65987 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -20,97 +20,10 @@ name: pr-check on: [pull_request] jobs: - windows: - name: Windows - runs-on: windows-2022 - timeout-minutes: 60 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> ${env:GITHUB_OUTPUT} - - - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: yarn - run: | - yarn --frozen-lockfile --network-timeout 180000 - - - name: Run Build - timeout-minutes: 20 - run: yarn build - - darwin: - name: macOS - runs-on: macos-11 - timeout-minutes: 40 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT} - - - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Execute yarn - if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} - run: yarn --frozen-lockfile --network-timeout 180000 - - - name: Run Build - timeout-minutes: 20 - run: yarn build - - linux: - name: Linux - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT} - - - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Execute yarn - run: yarn --frozen-lockfile - - - name: Run Build - timeout-minutes: 20 - run: yarn build - + pr-check-job: + strategy: + matrix: + target: [windows-2022, macos-11, ubuntu-20.04] + uses: redhat-developer/podman-desktop-redhat-account-ext/.github/workflows/build.yaml@main + with: + runs-on: ${{ matrix.target }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 12085d7..e2253cb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -44,6 +44,7 @@ jobs: - uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.branch }} + - name: Generate tag utilities id: TAG_UTIL run: | @@ -64,6 +65,7 @@ jobs: echo "Tagging with ${{ steps.TAG_UTIL.outputs.githubTag }}" git tag ${{ steps.TAG_UTIL.outputs.githubTag }} git push origin ${{ steps.TAG_UTIL.outputs.githubTag }} + - name: Create Release id: create_release uses: ncipollo/release-action@v1 @@ -77,43 +79,11 @@ jobs: build: needs: [tag] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.inputs.branch }} - - - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(npx yarn cache dir)" >> ${GITHUB_OUTPUT} - - - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Execute yarn - if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} - run: npx yarn --frozen-lockfile --network-timeout 180000 - - - name: Run Build - run: npx yarn build - - - name: Login to quay.io - run: podman login --username ${{ secrets.QUAY_ROBOT_NAME }} --password ${{ secrets.QUAY_ROBOT_TOKEN }} quay.io - - - name: Build Image - id: build-image - run: | - podman build -t quay.io/redhat-developer/podman-desktop-redhat-account-ext:${{ needs.tag.outputs.extVersion }} . - podman push quay.io/redhat-developer/podman-desktop-redhat-account-ext:${{ needs.tag.outputs.extVersion }} + uses: redhat-developer/podman-desktop-redhat-account-ext/.github/workflows/build.yaml@main + with: + runs-on: ubuntu-latest + registry: quay + ext-version: ${{ needs.tag.outputs.extVersion }} release: needs: [tag, build] @@ -121,12 +91,12 @@ jobs: runs-on: ubuntu-20.04 steps: - name: id - run: echo the release id is ${{ needs.tag.outputs.releaseId}} + run: echo the release id is ${{ needs.tag.outputs.releaseId }} - name: Publish release uses: StuYarrow/publish-release@v1.1.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - id: ${{ needs.tag.outputs.releaseId}} + id: ${{ needs.tag.outputs.releaseId }}