Skip to content

workflow updated

workflow updated #124

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags: [v*]
paths-ignore:
- README.md
- CHANGELOG.md
- LICENSE
pull_request:
# Sequence of patterns matched against refs/heads
branches:
- main
paths-ignore:
- README.md
- CHANGELOG.md
- LICENSE
env:
PROJECT: 'datasance'
controller_image: 'ghcr.io/datasance/controller:latest'
agent_image: 'ghcr.io/datasance/agent:latest'
operator_image: 'ghcr.io/datasance/operator:latest'
kubelet_image: 'ghcr.io/datasance/iofog-kubelet:latest'
port_manager_image: 'ghcr.io/datasance/port-manager:latest'
router_image: 'ghcr.io/datasance/router:latest'
router_arm_image: 'ghcr.io/datasance/router:latest'
proxy_image: 'ghcr.io/datasance/proxy:latest'
proxy_arm_image: 'ghcr.io/datasance/proxy:latest'
iofog_agent_version: '3.1.0'
controller_version: '3.0.6'
version:
agent_vm_list:
controller_vm:
jobs:
Build:
runs-on: ubuntu-20.04
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
name: Build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.18'
cache: false
- run: go version
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.1
args: --timeout=5m0s
- name: Run bootstrap
run: PIPELINE=1 script/bootstrap.sh
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: v0.0.0
- name: Set image tag
shell: bash
id: tags
run: |
if [[ ${{ github.ref_name }} =~ ^v.* ]] ; then
echo "VERSION=${{ github.ref_name }}" >> "${GITHUB_OUTPUT}"
else
echo "VERSION=${{ steps.previoustag.outputs.tag }}-dev" >> "${GITHUB_OUTPUT}"
fi
- name: Get image tag
run: |
echo ${{ steps.tags.outputs.VERSION }}
- name: potctl build packages GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: 1.1.0
args: --snapshot --rm-dist --debug --config ./.goreleaser-potctl.yml
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: potctl
path: ${{ github.workspace }}/dist
Publish_potctl_Prod:
needs: [Build]
runs-on: ubuntu-latest
permissions:
actions: write
checks: write
contents: write
deployments: write
id-token: write
issues: write
discussions: write
packages: write
pages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
name: Publish potctl Prod
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.18'
cache: false
- name: Get image tag
run: |
echo ${{ needs.Build.outputs.VERSION }}
- name: potctl build packages GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: ${{ env.GITHUB_REF_NAME }}
args: --rm-dist --debug --config ./.goreleaser-potctl.yml
env:
VERSION: ${{ needs.Build.outputs.VERSION }}
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Install Packagecloud cli
run: go install github.com/edgeworx/packagecloud@v0.1.1
- run: ./.packagecloud-publish.sh
continue-on-error: true
env:
PACKAGECLOUD_TOKEN: ${{ secrets.packagecloud_token }}
PACKAGECLOUD_REPO: "datasance/potctl"
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: potctl
path: ${{ github.workspace }}/dist