Skip to content

Commit 3205f98

Browse files
committed
Fix GH Actions env var deprecation
1 parent 5a3a7b8 commit 3205f98

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,14 @@ jobs:
1717
with:
1818
go-version: 1.17.x
1919

20-
- name: Get release version
21-
id: get_version
22-
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})
23-
2420
- name: Checkout code
2521
uses: actions/checkout@v2
2622

27-
- name: Get CloudFlare Token
28-
run: echo ::set-env name=CLOUDFLARE_TOKEN::${{ secrets.CLOUDFLARE_TOKEN }}
29-
30-
- name: Get Test Domain Name
31-
run: echo ::set-env name=TEST_DOMAIN::${{ secrets.TEST_DOMAIN }}
32-
3323
- name: Test and Build
3424
run: make test all shasums
25+
env:
26+
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
27+
TEST_DOMAIN: ${{ secrets.TEST_DOMAIN }}
3528

3629
- name: Release
3730
uses: softprops/action-gh-release@v1

.github/workflows/tests.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,22 @@ jobs:
1919
timeout-minutes: 10
2020
steps:
2121
- name: Get uname
22-
run: echo ::set-env name=UNAME::$(uname)
23-
- name: Get CloudFlare Token
24-
run: echo ::set-env name=CLOUDFLARE_TOKEN::${{ secrets.CLOUDFLARE_TOKEN }}
25-
- name: Get Test Domain Name
26-
run: echo ::set-env name=TEST_DOMAIN::${{ secrets.TEST_DOMAIN }}
22+
run: echo UNAME=$(uname) >> $GITHUB_ENV
23+
2724
- name: Install Go
2825
uses: actions/setup-go@v2
2926
with:
3027
go-version: 1.15.x
28+
3129
- name: Checkout Code
3230
uses: actions/checkout@v2
31+
3332
- name: Test
3433
run: make test coverage
34+
env:
35+
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
36+
TEST_DOMAIN: ${{ secrets.TEST_DOMAIN }}
37+
3538
- name: Publish Test Results
3639
uses: EnricoMi/publish-unit-test-result-action@master
3740
with:
@@ -43,6 +46,7 @@ jobs:
4346
files: dist/test-results-${{ env.UNAME }}.xml
4447
report_individual_runs: true
4548
deduplicate_classes_by_file_name: false
49+
4650
- name: Publish Code Coverage
4751
uses: shogo82148/actions-goveralls@v1.4.2
4852
with:
@@ -57,8 +61,10 @@ jobs:
5761
uses: actions/setup-go@v2
5862
with:
5963
go-version: 1.15.x
64+
6065
- name: Checkout Code
6166
uses: actions/checkout@v2
67+
6268
- name: Test
6369
run: |
6470
$env:TEST_DOMAIN = '${{ secrets.TEST_DOMAIN }}'

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
MODULE := $(shell awk 'NR==1{print $$2}' go.mod)
44
REPO_NAME := cloudflare-ddns
55
VERSION := $(shell echo $$(ver=$$(git tag -l --points-at HEAD) && [ -z $$ver ] && ver=$$(git describe --always --dirty); printf $$ver))
6-
# This is set during CI in .github/workflows/release.yml
7-
RELEASE_VERSION ?= $(VERSION)
86
LDFLAGS := -s -w -X $(MODULE)/conf.Version=$(VERSION) -X $(MODULE)/conf.ModuleName=$(MODULE)
97
FLAGS := -trimpath
108
PROJECT_ROOT := $(shell cd -P -- '$(shell dirname -- "$0")' && pwd -P)
@@ -20,19 +18,21 @@ DOCKER_PLATFORMS ?= linux/amd64 linux/arm64
2018
DOCKER_REPO ?= mattolenik
2119
DOCKER_TAG ?= $(DOCKER_REPO)/cloudflare-ddns-client
2220
DOCKER_TAG_LATEST := $(DOCKER_TAG):latest
23-
DOCKER_TAG_VERSIONED := $(DOCKER_TAG):$(RELEASE_VERSION)
21+
DOCKER_TAG_VERSIONED := $(DOCKER_TAG):$(VERSION)
22+
export TEST_BINARY := $(DIST)/$(BIN_NAME)
2423

25-
export TEST_BINARY := $(DIST)/$(BIN_NAME)
24+
default: check-version all shasums readme test
2625

27-
default: all shasums readme test
26+
check-version:
27+
if [ -z "$(VERSION)" ]; then echo "VERSION variable must be set"; exit 1; fi
2828

2929
build: $(DIST)/$(BIN_NAME)
3030
$(DIST)/$(BIN_NAME): $(SOURCE)
3131
go build $(ARGS) $(FLAGS) -ldflags="$(LDFLAGS)" -o $@
3232

3333
all: $(addprefix $(DIST)/$(BIN_NAME)-,$(PLATFORMS))
3434

35-
docker-publish:
35+
docker-publish: check-version
3636
docker buildx build --push --tag $(DOCKER_TAG_LATEST) --tag $(DOCKER_TAG_VERSIONED) --platform linux/amd64,linux/arm64 .
3737

3838
clean:

0 commit comments

Comments
 (0)