|
| 1 | +# |
| 2 | +# Copyright (C) 2023 Red Hat, Inc. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +# SPDX-License-Identifier: Apache-2.0 |
| 17 | + |
| 18 | +name: release |
| 19 | + |
| 20 | +on: |
| 21 | + workflow_dispatch: |
| 22 | + inputs: |
| 23 | + version: |
| 24 | + description: 'Version to release' |
| 25 | + required: true |
| 26 | + branch: |
| 27 | + description: 'Branch to use for the release' |
| 28 | + required: true |
| 29 | + default: main |
| 30 | +env: |
| 31 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 32 | + |
| 33 | +jobs: |
| 34 | + |
| 35 | + tag: |
| 36 | + name: Tagging |
| 37 | + runs-on: ubuntu-22.04 |
| 38 | + outputs: |
| 39 | + githubTag: ${{ steps.TAG_UTIL.outputs.githubTag}} |
| 40 | + extVersion: ${{ steps.TAG_UTIL.outputs.extVersion}} |
| 41 | + releaseId: ${{ steps.create_release.outputs.id}} |
| 42 | + |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + ref: ${{ github.event.inputs.branch }} |
| 47 | + - name: Generate tag utilities |
| 48 | + id: TAG_UTIL |
| 49 | + run: | |
| 50 | + TAG_PATTERN=${{ github.event.inputs.version }} |
| 51 | + echo "githubTag=v$TAG_PATTERN" >> ${GITHUB_OUTPUT} |
| 52 | + echo "extVersion=$TAG_PATTERN" >> ${GITHUB_OUTPUT} |
| 53 | +
|
| 54 | + - name: tag |
| 55 | + run: | |
| 56 | + git config --local user.name ${{ github.actor }} |
| 57 | +
|
| 58 | + # Add the new version in package.json file |
| 59 | + #sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.TAG_UTIL.outputs.extVersion }}\",#g" package.json |
| 60 | + #git add package.json |
| 61 | +
|
| 62 | + # commit the changes |
| 63 | + #git commit -m "chore: 🥁 tagging ${{ steps.TAG_UTIL.outputs.githubTag }} 🥳" |
| 64 | + echo "Tagging with ${{ steps.TAG_UTIL.outputs.githubTag }}" |
| 65 | + git tag ${{ steps.TAG_UTIL.outputs.githubTag }} |
| 66 | + git push origin ${{ steps.TAG_UTIL.outputs.githubTag }} |
| 67 | + - name: Create Release |
| 68 | + id: create_release |
| 69 | + uses: ncipollo/release-action@v1 |
| 70 | + env: |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + with: |
| 73 | + tag: ${{ steps.TAG_UTIL.outputs.githubTag }} |
| 74 | + name: ${{ steps.TAG_UTIL.outputs.githubTag }} |
| 75 | + draft: true |
| 76 | + prerelease: false |
| 77 | + |
| 78 | + build: |
| 79 | + needs: [tag] |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - name: Uninstall existing Podman and dependencies |
| 83 | + run: | |
| 84 | + sudo apt-get -y -q autoremove --purge podman |
| 85 | + - name: Install latest podman |
| 86 | + run: | |
| 87 | + sudo apt-get update -y -qq |
| 88 | + sudo mkdir -p /etc/apt/keyrings |
| 89 | + curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key \ |
| 90 | + | gpg --dearmor \ |
| 91 | + | sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null |
| 92 | + echo \ |
| 93 | + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\ |
| 94 | + https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \ |
| 95 | + | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null |
| 96 | + sudo apt-get update -qq |
| 97 | + sudo apt-get -qq -y install containernetworking-plugins podman |
| 98 | + - run: podman system reset --force |
| 99 | + |
| 100 | + - run: podman info |
| 101 | + |
| 102 | + - uses: actions/checkout@v4 |
| 103 | + |
| 104 | + - uses: actions/setup-node@v3 |
| 105 | + with: |
| 106 | + node-version: 16 |
| 107 | + |
| 108 | + - name: Login to ghcr.io |
| 109 | + run: podman login --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io |
| 110 | + |
| 111 | + - name: Build Image |
| 112 | + id: build-image |
| 113 | + run: | |
| 114 | + IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/podman-desktop-image-checker-openshift-ext |
| 115 | + ./scripts/build.sh ${IMAGE_NAME} ${{ needs.tag.outputs.extVersion }} |
| 116 | +
|
| 117 | + release: |
| 118 | + needs: [tag, build] |
| 119 | + name: Release |
| 120 | + runs-on: ubuntu-22.04 |
| 121 | + steps: |
| 122 | + - name: id |
| 123 | + run: echo the release id is ${{ needs.tag.outputs.releaseId}} |
| 124 | + |
| 125 | + - name: Publish release |
| 126 | + |
| 127 | + env: |
| 128 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 129 | + with: |
| 130 | + id: ${{ needs.tag.outputs.releaseId}} |
0 commit comments