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

index.js: migration from lunar to oracular #4

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:

jobs:
debug1:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: Check commands
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Example:
```yml
jobs:
example:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: Example
steps:
- uses: actions/checkout@v4
Expand Down
26 changes: 21 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// Running a script that sets everything up

const exec = require('@actions/exec');
const core = require('@actions/core')
const core = require('@actions/core');

function error(message) {
core.setFailed(message);
process.exit(1);
}

async function installPkg(pkgname) {
let attempts = 0;
Expand All @@ -12,8 +17,7 @@ async function installPkg(pkgname) {
break;
} catch (error) {
if (attempts > 3) {
core.setFailed("Something went wrong :/");
process.exit(1);
error("Something went wrong :/");
}
attempts += 1;
continue;
Expand All @@ -22,10 +26,22 @@ async function installPkg(pkgname) {
}

async function start() {
let myOutput = '';
await exec.exec("grep", ["^DISTRIB_RELEASE=", "/etc/lsb-release"], {
listeners: {
stdout: (data) => {
myOutput += data.toString();
}
}
});
if (myOutput.split("=").at(-1).split(".").at(0) != "24") {
error("old version of ubuntu, must be version 24 of ubuntu");
}

await installPkg("libarchive-tools");

await exec.exec("sudo su -c \"echo 'deb http://archive.ubuntu.com/ubuntu/ lunar universe' > /etc/apt/sources.list.d/lunar.list\"");
await exec.exec("sudo su -c \"echo 'deb-src http://archive.ubuntu.com/ubuntu/ lunar universe' >> /etc/apt/sources.list.d/lunar.list\"");
await exec.exec("sudo su -c \"echo 'deb http://archive.ubuntu.com/ubuntu/ oracular universe' > /etc/apt/sources.list.d/oracular.list\"");
await exec.exec("sudo su -c \"echo 'deb-src http://archive.ubuntu.com/ubuntu/ oracular universe' >> /etc/apt/sources.list.d/oracular.list\"");

await installPkg("pacman-package-manager");
}
Expand Down