|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + eslint: |
| 9 | + name: Eslint |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v3 |
| 13 | + - name: Run linting rules |
| 14 | + uses: actions/setup-node@v3 |
| 15 | + with: |
| 16 | + node-version: 14 |
| 17 | + - run: npm ci |
| 18 | + - run: ./node_modules/eslint/bin/eslint.js --ext .jsx,.js src/ |
| 19 | + |
| 20 | + build: |
| 21 | + needs: [eslint] |
| 22 | + name: Build and push image |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + #permissions: |
| 26 | + # packages: write |
| 27 | + # contents: read |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout repo |
| 31 | + uses: actions/checkout@v3 |
| 32 | + - name: Add GITHUB_SHA_SHORT env property with commit short sha |
| 33 | + run: echo "GITHUB_SHA_SHORT=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV |
| 34 | + - name: Log in to Docker Hub |
| 35 | + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a |
| 36 | + with: |
| 37 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 38 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 39 | + #- name: Log in to the Container registry |
| 40 | + # uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
| 41 | + # with: |
| 42 | + # registry: ghcr.io |
| 43 | + # username: ${{ github.actor }} |
| 44 | + # password: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + - name: Build and push Docker image |
| 46 | + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 |
| 47 | + with: |
| 48 | + context: . |
| 49 | + push: true |
| 50 | + tags: openconceptlab/oclweb3:nightly, openconceptlab/oclweb3:3.0.0-alpha-${{env.GITHUB_SHA_SHORT}} |
| 51 | + |
| 52 | + release: |
| 53 | + needs: [build] |
| 54 | + runs-on: ubuntu-latest |
| 55 | + name: Release |
| 56 | + environment: rc |
| 57 | + steps: |
| 58 | + - name: Checkout repo |
| 59 | + uses: actions/checkout@v3 |
| 60 | + - name: Add GITHUB_SHA_SHORT env property with commit short sha |
| 61 | + run: echo "GITHUB_SHA_SHORT=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV |
| 62 | + - name: Tag and release |
| 63 | + uses: avakar/tag-and-release@v1 |
| 64 | + with: |
| 65 | + tag_name: 3.0.0-alpha-${{env.GITHUB_SHA_SHORT}} |
| 66 | + env: |
| 67 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments