From 60b50482c510bbe0893019128343cd56c230dcc3 Mon Sep 17 00:00:00 2001 From: Borales Date: Mon, 14 Oct 2019 00:12:01 +0200 Subject: [PATCH] Adding publish to docker --- .github/main.workflow | 83 ---------------------------- .github/workflows/docker-publish.yml | 21 +++++++ README.md | 2 + 3 files changed, 23 insertions(+), 83 deletions(-) delete mode 100644 .github/main.workflow create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/main.workflow b/.github/main.workflow deleted file mode 100644 index 498d701..0000000 --- a/.github/main.workflow +++ /dev/null @@ -1,83 +0,0 @@ -workflow "Pull Request" { - on = "pull_request" - resolves = ["Docker Lint [PR]", "Shell Lint [PR]", "Test [PR]"] -} - -action "Docker Lint [PR]" { - uses = "docker://replicated/dockerfilelint" - args = "Dockerfile" -} - -action "Shell Lint [PR]" { - uses = "actions/bin/shellcheck@master" - args = "entrypoint.sh" -} - -action "Test [PR]" { - uses = "actions/bin/bats@master" - args = "test/*.bats" -} - -workflow "Build and Publish" { - resolves = [ - "Docker Lint", - "Test", - "Docker Login", - "Docker Publish", - ] - on = "push" -} - -action "Master Branch" { - uses = "actions/bin/filter@master" - args = "branch master" -} - -action "Docker Lint" { - uses = "docker://replicated/dockerfilelint" - needs = ["Master Branch"] - args = "Dockerfile" -} - -action "Shell Lint" { - uses = "actions/bin/shellcheck@master" - needs = ["Master Branch"] - args = "entrypoint.sh" -} - -action "Test" { - uses = "actions/bin/bats@master" - needs = ["Master Branch"] - args = "test/*.bats" -} - -action "Build" { - uses = "actions/docker/cli@master" - needs = [ - "Docker Lint", - "Test", - "Shell Lint", - ] - args = "build -t yarn ." -} - -action "Docker Tag" { - uses = "actions/docker/tag@master" - args = "yarn borales/yarn --no-latest" - needs = ["Build"] -} - -action "Docker Login" { - uses = "actions/docker/login@master" - secrets = ["DOCKER_PASSWORD", "DOCKER_USERNAME"] - needs = ["Build"] -} - -action "Docker Publish" { - uses = "actions/docker/cli@master" - needs = [ - "Docker Login", - "Docker Tag", - ] - args = "push borales/yarn" -} diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..183f8ef --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,21 @@ +name: Publish Docker image + +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@master + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: borales/yarn + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + cache: true diff --git a/README.md b/README.md index 0b2ddc3..d878cdf 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ jobs: cmd: install ``` +> `cmd` value will be used as a command for Yarn + ### Secrets * `NPM_AUTH_TOKEN` - **Optional**. The token to use for authentication with the npm registry. Required for `yarn publish` ([more info](https://docs.npmjs.com/getting-started/working_with_tokens))