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

Run pre-built Docker image #195

Merged
1 commit merged into from
Oct 11, 2022
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
22 changes: 0 additions & 22 deletions .github/workflows/testing.yml

This file was deleted.

2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ outputs:
description: 'Version of the release built'
runs:
using: 'docker'
image: 'Dockerfile'
image: 'docker://ghcr.io/balena-io/deploy-to-balena-action:latest'
ab77 marked this conversation as resolved.
Show resolved Hide resolved
env:
BALENA_TOKEN: ${{ inputs.balena_token }}
BALENA_URL: ${{ inputs.environment }}
Expand Down
10 changes: 0 additions & 10 deletions repo.yml

This file was deleted.

79 changes: 79 additions & 0 deletions versionist.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
'use strict';

const execSync = require('child_process').execSync;
const yaml = require('yaml');
const fs = require('fs');
const regex = /(docker:\/\/ghcr.io\/balena-io\/deploy-to-balena-action):.*/i;

const getAuthor = (commitHash) => {
return execSync(`git show --quiet --format="%an" ${commitHash}`, {
encoding: 'utf8'
}).replace('\n', '');
};

const isIncrementalCommit = (changeType) => {
return Boolean(changeType) && changeType.trim().toLowerCase() !== 'none';
};

module.exports = {
// This setup allows the editing and parsing of footer tags to get version and type information,
// as well as ensuring tags of the type 'v<major>.<minor>.<patch>' are used.
// It increments in a semver compatible fashion and allows the updating of NPM package info.
editChangelog: true,
parseFooterTags: true,
getGitReferenceFromVersion: 'v-prefix',
incrementVersion: 'semver',
updateVersion: (cwd, version, callback) => {
const packageFile = `${cwd}/package.json`;
const packageData = require(packageFile);
packageData.version = version;
fs.writeFileSync(packageFile, JSON.stringify(packageData, null, 2));
const actionYml = `${cwd}/action.yml`;
const action = yaml.parse(fs.readFileSync(actionYml, 'utf8'));
action.runs.image = action.runs.image.replace(regex, `$1:v${version}`);
fs.writeFileSync(actionYml, yaml.stringify(action));
},

// Always add the entry to the top of the Changelog, below the header.
addEntryToChangelog: {
preset: 'prepend',
fromLine: 6
},

// Only include a commit when there is a footer tag of 'change-type'.
// Ensures commits which do not up versions are not included.
includeCommitWhen: (commit) => {
return isIncrementalCommit(commit.footer['change-type']);
},

// Determine the type from 'change-type:' tag.
// Should no explicit change type be made, then no changes are assumed.
getIncrementLevelFromCommit: (commit) => {
if (isIncrementalCommit(commit.footer['change-type'])) {
return commit.footer['change-type'].trim().toLowerCase();
}
},

// If a 'changelog-entry' tag is found, use this as the subject rather than the
// first line of the commit.
transformTemplateData: (data) => {
data.commits.forEach((commit) => {
commit.subject = commit.footer['changelog-entry'] || commit.subject;
commit.author = getAuthor(commit.hash);
});

return data;
},

template: [
'## v{{version}} - {{moment date "Y-MM-DD"}}',
'',
'{{#each commits}}',
'{{#if this.author}}',
'* {{capitalize this.subject}} [{{this.author}}]',
'{{else}}',
'* {{capitalize this.subject}}',
'{{/if}}',
'{{/each}}'
].join('\n')
};