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

Add: allow staging in another branch besides "master" #14

Merged
merged 1 commit into from
Sep 22, 2020
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
5 changes: 4 additions & 1 deletion docker-vars/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ This action takes care of that.
```yaml
- uses: openttd/actions/docker-vars@v1
with:
# (required) Repository on hub.docker.com to use
# (required) Repository on Container Registry to use
repository: ${{ github.repository }}

# (optional) Name of the branch used for development
branch-name: master

# (optional) Username to use for registry (if unset, this will be a dry-run)
registry-username: ${{ secrets.REGISTRY_USERNAME }}
```
Expand Down
4 changes: 3 additions & 1 deletion docker-vars/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ description: 'Defines variables for docker-build and docker-publish'
author: 'OpenTTD'
inputs:
repository:
description: 'Repository on hub.docker.com to use'
description: 'Repository on Container Registry to use'
default: ${{ github.repository }}
branch-name:
description: 'Name of the branch used for development (default=master)'
registry-username:
description: 'Username to use for registry (if unset, this will be a dry-run)'
outputs:
Expand Down
3 changes: 2 additions & 1 deletion docker-vars/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4080,6 +4080,7 @@ function setOutput(name, value) {
function run() {
return __awaiter(this, void 0, void 0, function* () {
const repository = core.getInput('repository', { required: true });
const branchName = core.getInput('branch-name') || 'master';
const registryUsername = core.getInput('registry-username');
const repositoryLowerCase = repository.toLowerCase();
setOutput('name', repositoryLowerCase);
Expand All @@ -4103,7 +4104,7 @@ function run() {
}
}
else {
if (github.context.ref === 'refs/heads/master') {
if (github.context.ref === `refs/heads/${branchName}`) {
isStaging = true;
}
else {
Expand Down
3 changes: 2 additions & 1 deletion docker-vars/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function setOutput(name: string, value: string): void {

async function run(): Promise<void> {
const repository = core.getInput('repository', {required: true})
const branchName = core.getInput('branch-name') || 'master'
const registryUsername = core.getInput('registry-username')

const repositoryLowerCase = repository.toLowerCase()
Expand All @@ -52,7 +53,7 @@ async function run(): Promise<void> {
isStaging = false
}
} else {
if (github.context.ref === 'refs/heads/master') {
if (github.context.ref === `refs/heads/${branchName}`) {
isStaging = true
} else {
isStaging = false
Expand Down