init auto release project

This commit is contained in:
Adrien Beaudouin 2024-08-22 19:03:09 +02:00
parent e1c03de704
commit 2078da51c7
2 changed files with 47 additions and 16 deletions

View File

@ -20,21 +20,21 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
- uses: docker/metadata-action@v5 # - uses: docker/metadata-action@v5
id: meta # id: meta
with: # with:
images: ${{ inputs.registry }}/${{ gitea.repository }} # images: ${{ inputs.registry }}/${{ gitea.repository }}
- uses: docker/login-action@v3 # - uses: docker/login-action@v3
with: # with:
registry: ${{ inputs.registry }} # registry: ${{ inputs.registry }}
username: ${{ inputs.username }} # username: ${{ inputs.username }}
password: ${{ inputs.password }} # password: ${{ inputs.password }}
- uses: docker/build-push-action@v6 # - uses: docker/build-push-action@v6
with: # with:
context: . # context: .
push: true # push: true
tags: ${{ steps.meta.outputs.tags }} # tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} # labels: ${{ steps.meta.outputs.labels }}
- uses: https://gitea.okami101.io/okami101/actions/release@main - uses: https://gitea.okami101.io/okami101/actions/release@main
if: ${{ inputs.release == 'true' }} if: ${{ inputs.release == 'true' }}
with: with:

View File

@ -10,12 +10,43 @@ async function run() {
const [owner, repo] = repository.split("/"); const [owner, repo] = repository.split("/");
const gitea_client = new gitea.GiteaApi({ const client = new gitea.GiteaApi({
BASE: `https://${host}/api/v1`, BASE: `https://${host}/api/v1`,
WITH_CREDENTIALS: true, WITH_CREDENTIALS: true,
TOKEN: token, TOKEN: token,
}); });
let release = await client.repository.repoGetReleaseByTag({
owner: owner,
repo: repo,
tag: body.tag_name,
});
const release_id = release.id;
let target_commitish = release.target_commitish;
if (
body.target_commitish &&
body.target_commitish !== release.target_commitish
) {
console.log(
`Updating commit from "${release.target_commitish}" to "${body.target_commitish}"`
);
}
target_commitish = body.target_commitish;
release = client.repository.repoEditRelease({
owner: owner,
repo: repo,
id: release_id,
body: {
body: body.body || release.body,
draft: body.draft !== undefined ? body.draft : release.draft,
name: body.name || release.name,
prerelease:
body.prerelease !== undefined ? body.prerelease : release.prerelease,
tag_name: body.tag_name || release.tag_name,
target_commitish: target_commitish,
},
});
console.log(`TEST ${host} ${token} ${repository} ${owner} ${repo}`); console.log(`TEST ${host} ${token} ${repository} ${owner} ${repo}`);
// console.log(`🎉 Release ready at ${response.html_url}`); // console.log(`🎉 Release ready at ${response.html_url}`);
} catch (error) { } catch (error) {