summaryrefslogtreecommitdiff
path: root/.github/workflows/macos.yml
blob: 0d4b9a96ce93fea62b0c5dfbe1ff6c3a5c8308e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: macOS (x86_64)

on:
  pull_request:
  push:
  release:
    types: [published]

jobs:
  build:

    strategy:
      matrix:
        os: [macos-15-intel]
        arch: [x86_64]

    runs-on: ${{ matrix.os }}

    concurrency:
        group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-macOS-${{ matrix.arch }}
        cancel-in-progress: true
    steps:
      - uses: actions/checkout@v2
        with:
          # WyriHaximus/github-action-get-previous-tag@master need it
          fetch-depth: 0
          submodules: true

      - name: Prepare local xmake
        run: cp -rf . ../xmake-source
      - uses: xmake-io/github-action-setup-xmake@v1
        with:
          xmake-version: local#../xmake-source
      - uses: little-core-labs/[email protected]
        id: tagName

      - name: Tests
        run: |
          xmake lua -v -D tests/run.lua
          xrepo --version

      - name: Artifact
        run: |
          brew install gnu-tar
          cd core
          xmake pack -y --autobuild=n --basename=xmake -o ../artifacts xmakesrc
          xmake f --embed=y -c
          xmake
          cp build/xmake ../artifacts/xmake-bundle
          cd ..
      - uses: actions/upload-artifact@v4
        with:
          name: xmake-latest.gz.run
          path: artifacts/xmake.gz.run
      - uses: actions/upload-artifact@v4
        with:
          name: xmake-latest.tar.gz
          path: artifacts/xmake.tar.gz
      - uses: actions/upload-artifact@v4
        with:
          name: xmake-latest.zip
          path: artifacts/xmake.zip
      - uses: actions/upload-artifact@v4
        with:
          name: xmake-bundle.macos.x86_64
          path: artifacts/xmake-bundle

        # upload artifacts to latest release
      - name: Get Previous tag
        id: previoustag
        uses: WyriHaximus/github-action-get-previous-tag@master

      - name: Upload artifacts to lastest release
        if: github.ref == 'refs/heads/master'
        uses: svenstaro/upload-release-action@v2
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: artifacts/xmake.zip
          asset_name: xmake-master.zip
          tag: ${{ steps.previoustag.outputs.tag }}
          overwrite: true

      - name: Upload artifacts to lastest release
        if: github.ref == 'refs/heads/master'
        uses: svenstaro/upload-release-action@v2
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: artifacts/xmake.tar.gz
          asset_name: xmake-master.tar.gz
          tag: ${{ steps.previoustag.outputs.tag }}
          overwrite: true

      - name: Publish gz runfile
        if: github.event.action == 'published'
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.release.upload_url }}
          asset_path: artifacts/xmake.gz.run
          asset_name: xmake-${{ steps.tagName.outputs.tag }}.gz.run
          asset_content_type: application/zip

      - name: Publish gz archive
        if: github.event.action == 'published'
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.release.upload_url }}
          asset_path: artifacts/xmake.tar.gz
          asset_name: xmake-${{ steps.tagName.outputs.tag }}.tar.gz
          asset_content_type: application/zip

      - name: Publish zip archive
        if: github.event.action == 'published'
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.release.upload_url }}
          asset_path: artifacts/xmake.zip
          asset_name: xmake-${{ steps.tagName.outputs.tag }}.zip
          asset_content_type: application/zip

      - name: Publish bundle binary
        if: github.event.action == 'published'
        uses: actions/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.release.upload_url }}
          asset_path: artifacts/xmake-bundle
          asset_name: xmake-bundle-${{ steps.tagName.outputs.tag }}.macos.x86_64
          asset_content_type: application/zip