Skip to content

Commit

Permalink
Run pre-built Docker image
Browse files Browse the repository at this point in the history
Co-authored-by: Page- <[email protected]>

Change-type: patch
  • Loading branch information
ab77 committed Oct 11, 2022
1 parent 207bc7d commit e8769e2
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 33 deletions.
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'
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')
};

0 comments on commit e8769e2

Please sign in to comment.