Skip to content

v0.7.7

v0.7.7 #48

Workflow file for this run

name: Release
on:
release:
types: [published]
jobs:
init:
name: 🚩 Initialize
runs-on: ubuntu-latest
steps:
- name: Cancel previous workflow
uses: styfle/[email protected]
with:
access_token: ${{ secrets.PAT }}
build:
name: ✏️ Generate
runs-on: ubuntu-20.04
needs: init
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: Get version
run: echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Cleanup
run: rm -rf api docs test *.go go.* .gitignore
- name: OpenAPI Generator
uses: hatamiarash7/openapi-generator@main
with:
generator: go
generator-tag: v6.6.0
config-file: .github/generator/config.yml
openapi-url: https://mehrdadep1.s3.ir-tbz-sh1.arvanstorage.ir/v4.openapi.yml
command-args: "--http-user-agent r1c-cdn-sdk"
output-dir: "/github/workspace"
template-dir: .github/generator/template/
- name: Update output
run: bash .github/generator/tune.sh
- name: Get version
id: version
uses: jbutcher5/read-yaml@main
with:
file: "./api/openapi.yaml"
key-path: '["info", "version"]'
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: "1.18"
- name: Build
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
LDFLAGS: -s -w
run: go build -trimpath -ldflags "$LDFLAGS" -o "./cdn" .
- name: Test
run: |
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
go test -v -race ./... -json > TestResults.json
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Test-results
path: TestResults.json
- name: Cleanup
run: rm -rf cdn TestResults.json
- name: Github - Commit & Push changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: "SDK ${{ env.APP_VERSION }} - API v${{ steps.version.outputs.data }}"
commit_user_name: "ArvanCloud"
commit_user_email: "[email protected]"
commit_author: Arash <[email protected]>
- name: Gitlab - Commit & Push changes
run: |
git config user.name "Arash Hatami"
git config user.email "[email protected]"
git remote add gitlab "https://oauth2:${{ secrets.GLPAT }}@git.arvancloud.ir/arvancloud/cdn/cdn-go-sdk.git"
git fetch --depth=10000
git checkout main
git pull origin main
git commit --allow-empty -a -m "SDK ${{ env.APP_VERSION }} - API v${{ steps.version.outputs.data }}"
git push --set-upstream gitlab main -f --tag
- name: Gitlab - Create release
uses: indiesdev/[email protected]
with:
url: https://git.arvancloud.ir/api/v4/projects/117/releases
method: "POST"
accept: 201
headers: '{"PRIVATE-TOKEN": "${{ secrets.GLPAT }}"}'
body: '{"name": "${{ github.event.release.name }}", "tag_name": "${{ env.APP_VERSION }}", "description": "${{ github.event.release.body }}"}'
timeout: 2000
log-response: true
retries: 2