Skip to content

Commit 16601a3

Browse files
authored
Merge pull request #1 from redhat-actions/create_action
chore(test): create initial draft for github action
2 parents 4f55e32 + c6fb7d7 commit 16601a3

2 files changed

Lines changed: 130 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# /**********************************************************************
2+
# * Copyright (C) 2025 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+
19+
name: Create Release on Push
20+
21+
on:
22+
push:
23+
branches:
24+
- main
25+
26+
jobs:
27+
create_release:
28+
runs-on: ubuntu-24.04
29+
permissions:
30+
contents: write # Grant permission to create releases/tags
31+
steps:
32+
# This new step manually calculates the short SHA
33+
- name: Get short SHA
34+
id: get_sha
35+
run: echo "sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
36+
37+
# This step now uses the output from the step above
38+
- name: Create Release
39+
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
tag_name: commit-${{ steps.get_sha.outputs.sha }}
44+
release_name: Release ${{ steps.get_sha.outputs.sha }}
45+
body: |
46+
Automatic release created from commit ${{ github.sha }} on the main branch.
47+
draft: false
48+
prerelease: true

action.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# /**********************************************************************
2+
# * Copyright (C) 2025 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+
19+
name: "Install Podman 5.x"
20+
description: "Installs/updates Podman to v5 from the Kubic repository on Ubuntu."
21+
22+
inputs:
23+
ubuntu-version:
24+
description: "The Ubuntu version codename for the Kubic repository."
25+
required: false
26+
default: "23.10"
27+
28+
runs:
29+
using: "composite"
30+
steps:
31+
- name: Update podman to 5.x
32+
if: runner.os == 'Linux'
33+
shell: bash
34+
run: |
35+
ubuntu_version='${{ inputs.ubuntu-version }}'
36+
echo "INFO: Using Ubuntu version '${ubuntu_version}' for Kubic repository."
37+
38+
echo "INFO: Adding Kubic repository..."
39+
sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list"
40+
curl -fsSL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/kubic.gpg
41+
42+
echo "INFO: Updating package list..."
43+
sudo apt-get update -qq
44+
45+
echo "INFO: Installing CRIU dependencies..."
46+
sudo apt-get install --allow-unauthenticated -qq -y libprotobuf32t64 python3-protobuf libnet1
47+
48+
echo "INFO: Installing CRIU manually..."
49+
curl -sLO http://archive.ubuntu.com/ubuntu/pool/universe/c/criu/criu_3.16.1-2_amd64.deb && sudo dpkg -i criu_3.16.1-2_amd64.deb
50+
51+
echo "INFO: Installing Podman..."
52+
sudo apt-get -qq -y install --allow-unauthenticated podman || {
53+
echo "WARN: Primary installation failed. Trying fallback repository..."
54+
sudo sh -c "echo 'deb http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list"
55+
curl -fsSL "http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/kubic-fallback.gpg
56+
sudo apt-get --allow-insecure-repositories update -qq
57+
sudo apt-get --allow-unauthenticated -y install podman
58+
}
59+
60+
echo "INFO: Podman installation complete."
61+
podman version
62+
63+
- name: Install Podman on Windows
64+
if: runner.os == 'Windows'
65+
shell: pwsh
66+
run: |
67+
echo "Installing Podman..."
68+
curl --output podman-setup.exe -L https://github.com/containers/podman/releases/download/v5.3.2/podman-5.3.2-setup.exe
69+
# Start the installer and wait for it to complete
70+
Start-Process -FilePath .\podman-setup.exe -ArgumentList "/install", "/passive", "/norestart", "/log podman-logs.txt" -Wait
71+
# Check the logs for debugging purposes
72+
Get-Content podman-logs.txt
73+
74+
- name: Initialize Podman Machine on Windows
75+
if: runner.os == 'Windows'
76+
shell: pwsh
77+
run: |
78+
echo "Adding Podman to PATH for this session..."
79+
$env:PATH += ";C:\Program Files\RedHat\Podman"
80+
podman --version
81+
echo "Initializing Podman machine..."
82+
podman machine init --now

0 commit comments

Comments
 (0)