Skip to content

Commit

Permalink
ci(release): use gh action default token
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Oct 6, 2022
1 parent 15b10ce commit d000b8d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 7 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release-dry-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: release

defaults:
run:
shell: bash

on:
push:
branches:
- main

jobs:
goreleaser:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GOLANG_VERSION }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: branch name
id: branch_name
run: |
echo ::set-output name=RELEASE_TAG::${GITHUB_REF#refs/tags/}
- name: release dry-run
run: make release
env:
RELEASE_TAG: ${{ steps.branch_name.outputs.RELEASE_TAG }}
21 changes: 14 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ defaults:

on:
push:
branches:
- main
tags:
- v*

jobs:
goreleaser:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -32,17 +32,24 @@ jobs:
id: branch_name
run: |
echo ::set-output name=RELEASE_TAG::${GITHUB_REF#refs/tags/}
- if: startsWith(github.ref,'refs/tags/v')
name: release dry-run
- name: release dry-run
run: make release
env:
RELEASE_TAG: ${{ steps.branch_name.outputs.RELEASE_TAG }}
- if: startsWith(github.ref,'refs/tags/v') && github.repository == 'ovrclk/provider-services'
name: release publish
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# - name: docker creds
# run: |
# echo "{\"registries\": [{\"user\": \"${{ github.repository_owner }}\", \"pass\": \"${{ secrets.GITHUB_TOKEN }}\", \"registry\": \"ghcr.io\" }] }" > .docker-creds
- name: release publish
run: |
sudo rm -rf dist
make release
env:
GORELEASER_RELEASE: true
RELEASE_TAG: ${{ steps.branch_name.outputs.RELEASE_TAG }}
GITHUB_TOKEN: ${{ secrets.GORELEASER_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions make/releasing.mk
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ release: modvendor gen-changelog
-e GITHUB_TOKEN="$(GITHUB_TOKEN)" \
-e GORELEASER_CURRENT_TAG="$(RELEASE_TAG)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(HOME)/.docker/config.json:/root/.docker/config.json \
-v $(shell pwd):/go/src/$(GO_MOD_NAME) \
-w /go/src/$(GO_MOD_NAME)\
$(GORELEASER_IMAGE) \
Expand Down

0 comments on commit d000b8d

Please sign in to comment.